“ class Computer def initialize(computer_id, data_source) @id = computer_id @data_source = data_source end » def self.define_component(name) » define_method(name) do » info = @data_source.send "get_#{name}_info", @id » price = @data_source.send "get_#{name}_price", @id » result = "#{name.to_s.capitalize}: #{info} ($#{price})" » return "* #{result}" if price >= 100 » result » end » end » » define_component :mouse » define_component :cpu » define_component :keyboard end ”
―
Metaprogramming Ruby: Program Like the Ruby Pros
Share this quote:
Friends Who Liked This Quote
To see what your friends thought of this quote, please sign up!
0 likes
All Members Who Liked This Quote
None yet!
This Quote Is From
Metaprogramming Ruby: Program Like the Ruby Pros
by
Paolo Perrotta777 ratings, average rating, 45 reviews
Browse By Tag
- love (101753)
- life (80270)
- inspirational (76916)
- humor (44902)
- philosophy (31521)
- inspirational-quotes (28616)
- god (27040)
- wisdom (24830)
- truth (24717)
- romance (24714)
- poetry (23709)
- life-lessons (22765)
- quotes (21367)
- death (20809)
- happiness (18983)
- hope (18798)
- faith (18591)
- inspiration (17989)
- spirituality (15996)
- motivational (15954)
- relationships (15855)
- religion (15528)
- life-quotes (15207)
- writing (15080)
- love-quotes (14841)
- success (14181)
- motivation (14035)
- time (12951)
- science (12248)
- motivational-quotes (12109)
