“ 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 (101917)
- life (80352)
- inspirational (76794)
- humor (44593)
- philosophy (31391)
- inspirational-quotes (29061)
- god (27021)
- truth (24912)
- wisdom (24875)
- romance (24537)
- poetry (23566)
- life-lessons (22792)
- quotes (21202)
- death (20688)
- happiness (19059)
- hope (18741)
- faith (18581)
- inspiration (17802)
- spirituality (15910)
- relationships (15781)
- motivational (15757)
- religion (15480)
- life-quotes (15443)
- love-quotes (15064)
- writing (15021)
- success (14210)
- motivation (13707)
- time (12946)
- motivational-quotes (12231)
- science (12197)
