Sha256: 19cde43d58534afd435c61df77dfe5236bc3c17329e0af5a5e14b2d394fdd5d1

Contents?: true

Size: 601 Bytes

Versions: 13

Compression:

Stored size: 601 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
    end # Model
  end # module Models
end # module IB

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
ib-ruby-0.5.18 lib/ib-ruby/models/model.rb
ib-ruby-0.5.17 lib/ib-ruby/models/model.rb
ib-ruby-0.5.16 lib/ib-ruby/models/model.rb
ib-ruby-0.5.15 lib/ib-ruby/models/model.rb
ib-ruby-0.5.14 lib/ib-ruby/models/model.rb
ib-ruby-0.5.13 lib/ib-ruby/models/model.rb
ib-ruby-0.5.12 lib/ib-ruby/models/model.rb
ib-ruby-0.5.11 lib/ib-ruby/models/model.rb
ib-ruby-0.5.10 lib/ib-ruby/models/model.rb
ib-ruby-0.5.9 lib/ib-ruby/models/model.rb
ib-ruby-0.5.7 lib/ib-ruby/models/model.rb
ib-ruby-0.5.2 lib/ib-ruby/models/model.rb
ib-ruby-0.5.0 lib/ib-ruby/models/model.rb