Class: WEEL::ReadOnlyHash

Inherits:
Object
  • Object
show all
Includes:
HashExt
Defined in:
lib/weel.rb

Overview

}}}

Instance Method Summary collapse

Methods included from HashExt

#any?, #empty?, #method_missing, #to_json

Constructor Details

#initialize(values) ⇒ ReadOnlyHash

Returns a new instance of ReadOnlyHash.



304
305
306
307
308
309
310
311
312
313
314
315
316
# File 'lib/weel.rb', line 304

def initialize(values)
  @__weel_values = values.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
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class WEEL::HashExt