closer changed the topic of #ruby-core to: check the latest release candidate for 1.9.1 release ftp.ruby-lang.org:/home/yugui/ruby-1.9.1-r26021+1.tar.bz2
Aethenelle has quit [Quit: Aethenelle]
<znz_jp> biff: [ruby-changes:42862] nobu:r54936 (trunk): random.c: unnecessary declarations - http://mla.n-z.jp/?ruby-changes=42862
tax has joined #ruby-core
<znz_jp> biff: [ruby-changes:42863] nobu:r54937 (trunk): random.c: split random_int32 - http://mla.n-z.jp/?ruby-changes=42863
tax has quit [Ping timeout: 260 seconds]
<znz_jp> biff: [ruby-changes:42864] nobu:r54938 (trunk): random.c: optimize int_pair_to_real_inclusive - http://mla.n-z.jp/?ruby-changes=42864
rafaelfranca has joined #ruby-core
rafaelfranca has quit [Changing host]
rafaelfranca has joined #ruby-core
rafaelfranca has quit [Remote host closed the connection]
madgen has quit [Ping timeout: 244 seconds]
madgen has joined #ruby-core
madgen has quit [Ping timeout: 276 seconds]
heroux has quit [Ping timeout: 260 seconds]
heroux has joined #ruby-core
<znz_jp> biff: [ruby-changes:42865] hsbt:r54939 (trunk): * test/webrick/test_ssl_server.rb: Added basic test for `webrick/ssl` - http://mla.n-z.jp/?ruby-changes=42865
<znz_jp> biff: [ruby-changes:42866] svn:r54940 (trunk): * properties. - http://mla.n-z.jp/?ruby-changes=42866
heroux has quit [Ping timeout: 240 seconds]
heroux has joined #ruby-core
<znz_jp> biff: [ruby-changes:42867] hsbt:r54941 (trunk): * lib/webrick/ssl.rb: Accept string value for SSLCertName. It is used - http://mla.n-z.jp/?ruby-changes=42867
charliesome has joined #ruby-core
<zzak> [Sukh, irc.freenode.net] I have a Customer class with :name, etc. instance variables and a Order class with :id, :customer_name. How do I let the new_order = Order.new grab the customer from the Customer class?
<zzak> [Sukh, irc.freenode.net] Usually this is done with foreign keys in a DB. I'm trying to learn by building a standalone ruby program.
<zzak> [apeiros, irc.freenode.net] _orangejuice: :foo is a symbol, not an instance variable. @foo is an instance variable.
<zzak> [Sukh, irc.freenode.net] I meant attr_accessor :name, :email
<zzak> [apeiros, irc.freenode.net] "the customer from the Customer class" makes no sense to me. did you mean the name?
<zzak> [apeiros, irc.freenode.net] otherwise: Customer.new gives you a customer instance.
<zzak> [Sukh, irc.freenode.net] Yes a reference of the who the customer is for that order.
<zzak> [apeiros, irc.freenode.net] not sure where the db comes in either - unless you leave out massive amounts of context…
<zzak> [apeiros, irc.freenode.net] well, you'd probably either pass it in in the constructor, or you'd have an accessor
<zzak> [apeiros, irc.freenode.net] class Order; def initialize(customer); @customer = customer; end; end; order = Order.new(Customer.new)
<zzak> [Sukh, irc.freenode.net] Thats what I was trying to understand.
<zzak> [Sukh, irc.freenode.net] That makes sense. For Order.new can I already access instance variables for an existing Customer instance?
<zzak> [Sukh, irc.freenode.net] *from an existing customer instance
<zzak> [Sukh, irc.freenode.net] Sorry If I'm not articulating correctly.
<zzak> [apeiros, irc.freenode.net] you can access their accessors (methods)
<zzak> [apeiros, irc.freenode.net] you can't access ivars from "outside" in ruby (which is why you have to define accessors, or write that kind of methods yourself)
<zzak> [apeiros, irc.freenode.net] nb, `attr_accessor :foo` is equivalent to `def foo; return @foo; end; def foo=(value); @foo = value; end`
<zzak> [apeiros, irc.freenode.net] i.e., it just defines two methods for you.
<zzak> [Sukh, irc.freenode.net] Ok. I misunderstood them as variables. That makes sense. So how does one create a bunch of customers (objects). Then later if one wants to create an order from the existing customers.
<zzak> [apeiros, irc.freenode.net] customer = Customer.new; order = Order.new(customer)
<zzak> [Sukh, irc.freenode.net] I understand attr_accessor :name, :email are getter and setter methods
<zzak> [apeiros, irc.freenode.net] yes, defines #name(), #name=(value), #email and #email=(value) methods which set and read @name and @email
<zzak> [Sukh, irc.freenode.net] That seems straightforward. What memory is that customer stored it? Thats why I bought up databases.
<zzak> [Sukh, irc.freenode.net] Thank you apeiros. I appreciate you mapping your answer to my problem.
<zzak> [apeiros, irc.freenode.net] variables are ram
<zzak> [apeiros, irc.freenode.net] if you want to persist the data, you need some kind of serialization in order to store your objects to a file or a db (which in the end will be a file / files too)
<zzak> [Sukh, irc.freenode.net] I see. Very cool. This makes a lot of sense. So in a typical web form, I'll collect/parse customer data, store it in a local variable, then database. For a order, grab customer data stuff from the database, since my local variables are clueless?
<zzak> [apeiros, irc.freenode.net] yes, in a typical web-app you'll use a db for persistency and populate your variables from that and/or from the form input
<zzak> [Sukh, irc.freenode.net] :) Thank you apeiros
<zzak> [Mariano, irc.freenode.net] hi all. I'm having an odd problem with pry and requiring many files by iterating them. When I start pry and run the require line manually, the require is made correctly. But if i comment out the pry call and just run the code, the require doesn't seem to work. If anyone can give me a hand, i will provide a gist. Thank you all in advance.
tax has joined #ruby-core
tax has quit [Ping timeout: 260 seconds]
tax has joined #ruby-core
nagachika has joined #ruby-core
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
nagachika has quit [Remote host closed the connection]
nagachika has joined #ruby-core
tax has quit [Ping timeout: 240 seconds]
nagachika has quit [Remote host closed the connection]
nagachika has joined #ruby-core
nagachika has quit [Ping timeout: 244 seconds]
rafaelfranca has joined #ruby-core
charliesome has joined #ruby-core