Class: IB::Datatypes::AbstractDatum
- Inherits:
-
Object
- Object
- IB::Datatypes::AbstractDatum
- Defined in:
- lib/ib-ruby/datatypes.rb
Direct Known Subclasses
Bar, ComboLeg, Contract, ContractDetails, Execution, ExecutionFilter, Order, ScannerSubscription
Instance Method Summary collapse
- #init ⇒ Object
-
#initialize(attributeHash = nil) ⇒ AbstractDatum
constructor
If a hash is given, keys are taken as attribute names, values as data.
Constructor Details
#initialize(attributeHash = nil) ⇒ AbstractDatum
If a hash is given, keys are taken as attribute names, values as data. The attrs of the instance are set automatically from the attributeHash.
If no hash is given, #init is called in the instance. #init should set the datum up in a generic state.
40 41 42 43 44 45 46 47 48 49 |
# File 'lib/ib-ruby/datatypes.rb', line 40 def initialize(attributeHash=nil) if attributeHash.nil? init else raise(ArgumentError.new("Argument must be a Hash")) unless attributeHash.is_a?(Hash) attributeHash.keys.each {|key| self.send((key.to_s + "=").to_sym, attributeHash[key]) } end end |
Instance Method Details
#init ⇒ Object
30 31 32 |
# File 'lib/ib-ruby/datatypes.rb', line 30 def init @created_at = Time.now end |