justincollins | 1 Sep 2011 01:00
Favicon

Re: ripper on array access operation

Quoting "Surya G." <sgaddipati <at> obtiva.com>:

> unknown wrote in post #1019486:
>> Quoting "Surya G." <sgaddipati <at> obtiva.com>:
>>
>>> called is present.
>>> I get the information about which method was called.
>>>
>>> --
>>> Posted via http://www.ruby-forum.com/.
>>>
>>>
>>
>> I am pretty sure it's the :aref part. Ripper is making [] a special
>> case.
>>
>> -Justin
>
> Thats what it looks like but why not treat aref as any-other method
> call.
>
> --
> Posted via http://www.ruby-forum.com/.
>

I don't know. Ripper's output looks like a mess to me when compared to  
RubyParser:

s(:call, s(:call, nil, :a, s(:arglist)), :[], s(:arglist, s(:lit, 1)))

(Continue reading)

yw hi | 1 Sep 2011 01:11

how to pass a variable to a method in an existing class?

Hi,

I am a new ruby user and I want to add a function to an existing class.
I googled the answer and found part of the solution. All findings on the
web adding a new method without a variable. In my case I want to use the
string as a variable. Here is what I want to do:
class String

def convert(x)
#code to convert the x
x.upcase
end
end

What I want is in the irb I can use the new method in the way as:

"a".convert

This will convert a to upper case. However, it does not take the "a" as
the input variable and generating error
ArgumentError: wrong number of arguments (0 for 1)

How do I acheive what I want?

Thanks

Frank

--

-- 
Posted via http://www.ruby-forum.com/.
(Continue reading)

Ryan Davis | 1 Sep 2011 01:18
Gravatar

[ANN] autotest-rails 4.1.1 Released

autotest-rails version 4.1.1 has been released!

* <https://github.com/seattlerb/autotest-rails>

This is an autotest plugin to provide rails support. It provides basic
rails support and extra plugins for migrations and fixtures.

Changes:

### 4.1.1 / 2011-08-31

* 1 minor enhancement:

  * #path_to_classname can test non-standard rails directories (apotonick)

Marcin Grzywaczewski | 1 Sep 2011 01:20
Picon
Gravatar

Re: how to pass a variable to a method in an existing class?

"self" is a pointer to an actual element. So if you write:
class String
  def convert
    self.upcase
  end
end

It'll be perfectly fine.

Yours
Martin

2011/9/1 yw hi <yw_hi <at> 163.com>:
> Hi,
>
> I am a new ruby user and I want to add a function to an existing class.
> I googled the answer and found part of the solution. All findings on the
> web adding a new method without a variable. In my case I want to use the
> string as a variable. Here is what I want to do:
> class String
>
> def convert(x)
> #code to convert the x
> x.upcase
> end
> end
>
> What I want is in the irb I can use the new method in the way as:
>
> "a".convert
(Continue reading)

Spax T. | 1 Sep 2011 01:32
Picon

Re: how to pass a variable to a method in an existing class?

--Marcin's way is perfect; but there is something we don't understand
about your requirement:

"...I want to use the string as a variable

def convert(x)
> #code to convert the x
..."

then..."in the irb I can use the new method in the way as:
>
> "a".convert <---what's happened to ur variable x???

Best Regards,

frank hi wrote in post #1019491:
> Hi,
>
> I am a new ruby user and I want to add a function to an existing class.
> I googled the answer and found part of the solution. All findings on the
> web adding a new method without a variable. In my case I want to use the
> string as a variable. Here is what I want to do:
> class String
>
> def convert(x)
> #code to convert the x
> x.upcase
> end
> end
>
(Continue reading)

frank hi | 1 Sep 2011 01:38

Re: how to pass a variable to a method in an existing class?

Martin's answer solved my problem.

Basically, I wrote my own method and want to add to the existing class 
and expected that the "string".convert will pass the "string" to the 
method. However, I could not find the solution to let the convert method 
takes the "string" as input. the self pointer solved the issue.

Thanks

Frank

--

-- 
Posted via http://www.ruby-forum.com/.

Ryan Davis | 1 Sep 2011 01:38
Gravatar

[ANN] isolate 3.2.0 Released


isolate version 3.2.0 has been released!

* <http://github.com/jbarnette/isolate>

Isolate is a very simple RubyGems sandbox. It provides a way to
express and automatically install your project's Gem dependencies.

Changes:

### 3.2.0 / 2011-08-31

* 1 major enhancement:

  * hoe/isolate no longer globally activates isolate. Attach via :isolate dependency

* 2 minor enhancements:

  * Fix for custom gem server source overriding. (yaksnrainbows)
  * Remove isolated gems that are now satisfied globally. (luis)

* 3 bug fixes:

  * Reworked rakefile and dependencies
  * Fix for custom gem server sources being overwritten by rubygems
  * Resolve a constant undefined error with rake on ruby-1.9.2

Josh Cheek | 1 Sep 2011 02:44
Picon
Gravatar

Re: GUI programming

On Wed, Aug 31, 2011 at 3:23 PM, Alexey Petrushin <axyd80 <at> gmail.com> wrote:

> I believe right now it's better to stay with console, there's no Ruby
> GUI, only hacks.
>
> Shoes seems to be abandoned and buggy.
> Bowline looks nice but You has to write GUI in JavaScript, so it's not
> "Ruby GUI".
>
> --
> Posted via http://www.ruby-forum.com/.
>
>
I got a lot of help from the IRC channel, and Steve mentioned just recently
that he's still developing it (
http://blog.rubybestpractices.com/posts/gregory/050-issues-18-testing-dogma.html#comment-268721639).
Shoes is definitely not abandoned.

Biggest complaint I had was difficulty getting feedback (when I used Shoes,
it would swallow errors, as opposed to Limelight, which would report them on
stdout) IDK if its still set up that way, or if one of the other colours of
shoes doesn't do that. Second biggest is that IDK how you'd test most of
that stuff.
sunny parker | 1 Sep 2011 02:52

newbie question

i am coming from php and dont seem to quite understand how ruby works
with the browser.  how does one implement ruby code into html code?

--

-- 
Posted via http://www.ruby-forum.com/.

Buddy Lindsey, Jr. | 1 Sep 2011 02:56
Picon
Gravatar

Re: newbie question

You will need a framework like rails or sinatra to do web "stuff". I
recommend taking a look at rails, there are a lot of good tutorials online
to help get you started.
---
Buddy Lindsey
http://sourcehold.com
http://www.buddylindsey.com
http://www.twitter.com/buddylindsey

On Wed, Aug 31, 2011 at 7:52 PM, sunny parker <info <at> 2020proj.com> wrote:

> i am coming from php and dont seem to quite understand how ruby works
> with the browser.  how does one implement ruby code into html code?
>
> --
> Posted via http://www.ruby-forum.com/.
>
>

Gmane