Class: FruitToLime::ReferenceToSource
- Inherits:
-
Object
- Object
- FruitToLime::ReferenceToSource
- Includes:
- SerializeHelper
- Defined in:
- lib/fruit_to_lime/model/referencetosource.rb
Instance Attribute Summary collapse
-
#format ⇒ Object
Returns the value of attribute format.
-
#id ⇒ Object
Returns the value of attribute id.
-
#name ⇒ Object
Returns the value of attribute name.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #get_import_rows ⇒ Object
-
#initialize(opt = nil) ⇒ ReferenceToSource
constructor
A new instance of ReferenceToSource.
-
#par_se(id) ⇒ Object
Sets the id of this instance to the parameter supplied.
- #serialize_name ⇒ Object
- #serialize_variables ⇒ Object
- #to_s ⇒ Object
Methods included from SerializeHelper
#serialize, #serialize_to_file
Constructor Details
#initialize(opt = nil) ⇒ ReferenceToSource
Returns a new instance of ReferenceToSource.
20 21 22 23 24 25 26 27 |
# File 'lib/fruit_to_lime/model/referencetosource.rb', line 20 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
#format ⇒ Object
Returns the value of attribute format.
4 5 6 |
# File 'lib/fruit_to_lime/model/referencetosource.rb', line 4 def format @format end |
#id ⇒ Object
Returns the value of attribute id.
4 5 6 |
# File 'lib/fruit_to_lime/model/referencetosource.rb', line 4 def id @id end |
#name ⇒ Object
Returns the value of attribute name.
4 5 6 |
# File 'lib/fruit_to_lime/model/referencetosource.rb', line 4 def name @name end |
Instance Method Details
#==(other) ⇒ Object
33 34 35 36 37 38 |
# File 'lib/fruit_to_lime/model/referencetosource.rb', line 33 def ==(other) if other==nil return false end return @name == other.name && @id == other.id && @format== other.format end |
#get_import_rows ⇒ Object
14 15 16 17 18 |
# File 'lib/fruit_to_lime/model/referencetosource.rb', line 14 def get_import_rows (serialize_variables + [{ :id => :value, :type => :string }]).map do |p| map_to_row p end end |
#par_se(id) ⇒ Object
40 41 42 43 44 |
# File 'lib/fruit_to_lime/model/referencetosource.rb', line 40 def par_se(id) @name = 'pase' @format = 'External' @id = id end |
#serialize_name ⇒ Object
10 11 12 |
# File 'lib/fruit_to_lime/model/referencetosource.rb', line 10 def serialize_name "ReferenceToSource" end |
#serialize_variables ⇒ Object
6 7 8 |
# File 'lib/fruit_to_lime/model/referencetosource.rb', line 6 def serialize_variables [:name, :format, :id].map { |prop| { :id => prop, :type => :string } } end |
#to_s ⇒ Object
29 30 31 |
# File 'lib/fruit_to_lime/model/referencetosource.rb', line 29 def to_s return "#{@name}_#{@format}_#{@id}" end |