Sha256: 976afe601dd21a84e747d3882eb044ffbfbcb2bd9392dc80e8ec25a01332713c
Contents?: true
Size: 765 Bytes
Versions: 2
Compression:
Stored size: 765 Bytes
Contents
module IB module Models # Base IB data Model class, in future it will be developed into ActiveModel class Model attr_reader :created_at # If a opts hash is given, keys are taken as attribute names, values as data. # The model instance fields are then set automatically from the opts Hash. # def initialize(opts={}) raise ArgumentError.new("Argument must be a Hash") unless opts.is_a?(Hash) @created_at = Time.now opts.keys.each { |key| self.send("#{key}=", opts[key]) } end # ActiveModel-style attribute accessors def [] key self.send key end def []= key, val self.send "#{key}=", val end end # Model end # module Models end # module IB
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ib-ruby-0.5.21 | lib/ib-ruby/models/model.rb |
ib-ruby-0.5.19 | lib/ib-ruby/models/model.rb |