Module: Dumbstats::Initialization
Instance Method Summary collapse
Instance Method Details
#initialize(*args) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/dumbstats.rb', line 14 def initialize *args super() opts = nil if args.size == 1 opts = args.first else args.each do | a | opts ||= { } opts.update(a) if a end end update_from_hash! opts end |
#update_from_hash!(opts) ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'lib/dumbstats.rb', line 5 def update_from_hash! opts if opts opts.each do | k , v | send(:"#{k}=", v) end end self end |