Method: Xunch::HashCodec#initialize
- Defined in:
- lib/xunch/codec/hash_codec.rb
#initialize(klass, fields) ⇒ HashCodec
Returns a new instance of HashCodec.
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/xunch/codec/hash_codec.rb', line 4 def initialize(klass,fields) super(klass) temp_set_methods = {} temp_get_methods = {} @fields = fields @fields.each{ |field| temp_get_method = @get_methods[field] temp_set_method = @set_methods[field] if temp_set_method == nil || temp_get_method == nil raise XunchConfigError.new("field #{field} doesn't have set or get method") end temp_get_methods[field] = temp_get_method temp_set_methods[field] = temp_set_method } @set_methods = temp_set_methods @get_methods = temp_get_methods end |