Class: Hessian2::StructWrapper
- Inherits:
-
Object
- Object
- Hessian2::StructWrapper
- Defined in:
- lib/hessian2/struct_wrapper.rb
Instance Attribute Summary collapse
-
#values ⇒ Object
readonly
Returns the value of attribute values.
Instance Method Summary collapse
-
#initialize(klass, object) ⇒ StructWrapper
constructor
A new instance of StructWrapper.
Constructor Details
#initialize(klass, object) ⇒ StructWrapper
Returns a new instance of StructWrapper.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/hessian2/struct_wrapper.rb', line 5 def initialize(klass, object) raise "klass should not be nil: #{klass}" unless klass if klass.is_a?(Array) is_multi = true members = klass.first.members elsif klass.is_a?(String) if klass.include?('[') is_multi = true members = Kernel.const_get(klass.delete('[]')).members else is_multi = false members = Kernel.const_get(klass).members end else is_multi = false members = klass.members end if is_multi values = [] object.each do |o| values << get_values(members, o) end else values = get_values(members, object) end @values = values end |
Instance Attribute Details
#values ⇒ Object (readonly)
Returns the value of attribute values.
3 4 5 |
# File 'lib/hessian2/struct_wrapper.rb', line 3 def values @values end |