Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > What do you call this part of an object?

Reply
Thread Tools

What do you call this part of an object?

 
 
Mmcolli00 Mom
Guest
Posts: n/a
 
      12-10-2008
What do you call this part of an object? @action== positions=0,0
elements="\n","\n". Thanks in advance.

My Object
[#<Diff::LCS::ContextChange:24251690 @action== positions=0,0
elements="\n","\n">
--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
 
Brian Candler
Guest
Posts: n/a
 
      12-11-2008
Mmcolli00 Mom wrote:
> What do you call this part of an object? @action== positions=0,0
> elements="\n","\n". Thanks in advance.


They are instance variables.

class Foo
attr_accessor , :y
def initialize(x,y)
@x = x
@y = y
end
def say_something
puts "@x is #{@x} and @y is #{@y}"
end
end

f = Foo.new("hello", "world")
puts f.inspect
f.say_something

# Using the accessor methods which attr_accessor adds
f.x = "goodbye"
puts f.x
puts f.y

You really need to understand instance variables, classes and methods if
you are going to start programming in Ruby. I suggest you start here:
http://www.ruby-doc.org/docs/ProgrammingRuby/

(If you want a paper or PDF book, there are newer versions of this book
available from www.pragprog.com)
--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
 
Mmcolli00 Mom
Guest
Posts: n/a
 
      12-11-2008
Thanks Brian.
--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do you call the part with the underscore in thisshift->_date_header('Date',@_) gauthier@holnx2.dyndns.org Perl Misc 3 06-20-2008 08:58 PM
Variable displays at one part while does not in another part in a Jack ASP General 8 05-10-2005 07:26 PM
ActiveX apologetic Larry Seltzer... "Sun paid for malicious ActiveX code, and Firefox is bad, bad bad baad. please use ActiveX, it's secure and nice!" (ok, the last part is irony on my part) fernando.cassia@gmail.com Java 0 04-16-2005 10:05 PM
Easy part done, now the hard part!! jollyjimpoppy A+ Certification 0 09-10-2003 10:37 AM



Advertisments