Class: Marley::ReggaeInstance
- Inherits:
-
ReggaeResource
- Object
- Array
- Reggae
- ReggaeResource
- Marley::ReggaeInstance
- Defined in:
- lib/marley/reggae.rb
Instance Attribute Summary collapse
-
#schema ⇒ Object
Returns the value of attribute schema.
Attributes inherited from Reggae
#contents, #properties, #resource_type
Instance Method Summary collapse
- #col_value(col_name, col_value = nil) ⇒ Object
-
#initialize(*args) ⇒ ReggaeInstance
constructor
A new instance of ReggaeInstance.
- #set_values(col_hash) ⇒ Object
- #to_params ⇒ Object
Methods inherited from ReggaeResource
Methods inherited from Reggae
#find_instances, get_resource, #is_resource?, mk_prop_methods, properties, #to_resource
Constructor Details
#initialize(*args) ⇒ ReggaeInstance
Returns a new instance of ReggaeInstance.
88 89 90 91 92 |
# File 'lib/marley/reggae.rb', line 88 def initialize(*args) super @properties[:schema]=ReggaeSchema.new(self.schema) @schema=@properties[:schema] end |
Instance Attribute Details
#schema ⇒ Object
Returns the value of attribute schema.
87 88 89 |
# File 'lib/marley/reggae.rb', line 87 def schema @schema end |
Instance Method Details
#col_value(col_name, col_value = nil) ⇒ Object
99 100 101 102 103 |
# File 'lib/marley/reggae.rb', line 99 def col_value(col_name,col_value=nil) col=@schema[col_name] col.col_value=col_value if col_value col.col_value end |
#set_values(col_hash) ⇒ Object
104 105 106 107 |
# File 'lib/marley/reggae.rb', line 104 def set_values(col_hash) col_hash.each_pair {|k,v| col_value(k,v)} self end |
#to_params ⇒ Object
93 94 95 96 97 98 |
# File 'lib/marley/reggae.rb', line 93 def to_params @schema.inject({}) do |params,spec| params["#{name}[#{spec.col_name}]"]=spec.col_value unless (spec.col_restrictions & RESTRICT_RO > 0) params end end |