“ 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 (101877)
- life (79996)
- inspirational (76387)
- humor (44538)
- philosophy (31216)
- inspirational-quotes (29057)
- god (26991)
- truth (24854)
- wisdom (24810)
- romance (24494)
- poetry (23469)
- life-lessons (22767)
- quotes (21228)
- death (20644)
- happiness (19109)
- hope (18679)
- faith (18527)
- inspiration (17557)
- spirituality (15837)
- relationships (15752)
- life-quotes (15665)
- motivational (15548)
- religion (15450)
- love-quotes (15424)
- writing (14992)
- success (14233)
- travel (13647)
- motivation (13476)
- time (12914)
- motivational-quotes (12674)
