Class: WEEL::ReadStructure
- Inherits:
-
Object
- Object
- WEEL::ReadStructure
- Defined in:
- lib/weel.rb
Overview
}}}
Instance Attribute Summary collapse
-
#additional ⇒ Object
readonly
Returns the value of attribute additional.
Instance Method Summary collapse
- #data ⇒ Object
- #endpoints ⇒ Object
-
#initialize(data, endpoints, local, additional) ⇒ ReadStructure
constructor
{{{.
- #local ⇒ Object
- #method_missing(m, *args, &block) ⇒ Object
- #to_json(*a) ⇒ Object
- #update(d, e, s) ⇒ Object
Constructor Details
#initialize(data, endpoints, local, additional) ⇒ ReadStructure
{{{
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/weel.rb', line 49 def initialize(data,endpoints,local,additional) @__weel_data = data.transform_values do |v| if Object.const_defined?(:XML) && XML.const_defined?(:Smart) && v.is_a?(XML::Smart::Dom) v.root.to_doc else begin v.deep_dup rescue v.to_s rescue nil end end end @__weel_endpoints = endpoints.transform_values{ |v| v.dup } @__weel_local = local @additional = additional end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
Instance Attribute Details
#additional ⇒ Object (readonly)
Returns the value of attribute additional.
105 106 107 |
# File 'lib/weel.rb', line 105 def additional @additional end |
Instance Method Details
#endpoints ⇒ Object
99 100 101 |
# File 'lib/weel.rb', line 99 def endpoints ReadHash.new(@__weel_endpoints) end |
#local ⇒ Object
102 103 104 |
# File 'lib/weel.rb', line 102 def local ReadHash.new(@__weel_local) end |
#to_json(*a) ⇒ Object
66 67 68 69 70 71 72 |
# File 'lib/weel.rb', line 66 def to_json(*a) { 'data' => @__weel_data, 'endpoints' => @__weel_endpoints, 'additional' => @additional, }.to_json(*a) end |
#update(d, e, s) ⇒ Object
88 89 90 91 92 93 94 95 |
# File 'lib/weel.rb', line 88 def update(d,e,s) d.each do |k,v| data.__send(k+'=',v) end if d e.each do |k,v| endpoints.__send(k+'=',v) end if e end |