Class: OptionLab::Models::ClosedPosition

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/option_lab/models.rb

Overview

Closed position model

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ ClosedPosition

Returns a new instance of ClosedPosition.



70
71
72
73
# File 'lib/option_lab/models.rb', line 70

def initialize(attributes = {})
  @type = 'closed'
  super(attributes)
end

Instance Attribute Details

#prev_posObject

Returns the value of attribute prev_pos.



67
68
69
# File 'lib/option_lab/models.rb', line 67

def prev_pos
  @prev_pos
end

#typeObject (readonly)

Returns the value of attribute type.



68
69
70
# File 'lib/option_lab/models.rb', line 68

def type
  @type
end

Instance Method Details

#validate!Object

Raises:

  • (ArgumentError)


75
76
77
# File 'lib/option_lab/models.rb', line 75

def validate!
  raise ArgumentError, 'prev_pos must be a number' unless prev_pos.is_a?(Numeric)
end