Class: MoveToGo::Settings
- Inherits:
-
Object
- Object
- MoveToGo::Settings
- Includes:
- SerializeHelper
- Defined in:
- lib/move-to-go/model/settings.rb
Instance Attribute Summary collapse
-
#deal ⇒ Object
readonly
Returns the value of attribute deal.
-
#organization ⇒ Object
readonly
Returns the value of attribute organization.
-
#person ⇒ Object
readonly
Returns the value of attribute person.
Instance Method Summary collapse
-
#initialize(opt = nil) ⇒ Settings
constructor
A new instance of Settings.
- #serialize_name ⇒ Object
- #serialize_variables ⇒ Object
- #with_deal {|@deal| ... } ⇒ Object
- #with_organization {|@organization| ... } ⇒ Object
- #with_person {|@person| ... } ⇒ Object
Methods included from SerializeHelper
#get_import_rows, #serialize, #serialize_to_file
Constructor Details
#initialize(opt = nil) ⇒ Settings
Returns a new instance of Settings.
44 45 46 47 48 49 50 51 |
# File 'lib/move-to-go/model/settings.rb', line 44 def initialize(opt = nil) if opt != nil serialize_variables.each do |myattr| val = opt[myattr[:id]] instance_variable_set("@" + myattr[:id].to_s, val) if val != nil end end end |
Instance Attribute Details
#deal ⇒ Object (readonly)
Returns the value of attribute deal.
5 6 7 |
# File 'lib/move-to-go/model/settings.rb', line 5 def deal @deal end |
#organization ⇒ Object (readonly)
Returns the value of attribute organization.
5 6 7 |
# File 'lib/move-to-go/model/settings.rb', line 5 def organization @organization end |
#person ⇒ Object (readonly)
Returns the value of attribute person.
5 6 7 |
# File 'lib/move-to-go/model/settings.rb', line 5 def person @person end |
Instance Method Details
#serialize_name ⇒ Object
57 58 59 |
# File 'lib/move-to-go/model/settings.rb', line 57 def serialize_name "Settings" end |
#serialize_variables ⇒ Object
53 54 55 |
# File 'lib/move-to-go/model/settings.rb', line 53 def serialize_variables [:organization, :person, :deal].map {|p| {:id => p, :type => :class_settings} } end |
#with_deal {|@deal| ... } ⇒ Object
39 40 41 42 |
# File 'lib/move-to-go/model/settings.rb', line 39 def with_deal @deal = DealClassSettings.new if @deal ==nil yield @deal end |
#with_organization {|@organization| ... } ⇒ Object
15 16 17 18 |
# File 'lib/move-to-go/model/settings.rb', line 15 def with_organization @organization = ClassSettings.new if @organization ==nil yield @organization end |
#with_person {|@person| ... } ⇒ Object
27 28 29 30 |
# File 'lib/move-to-go/model/settings.rb', line 27 def with_person @person = ClassSettings.new if @person ==nil yield @person end |