Class: Perseus::CorpusHash
- Inherits:
-
Hash
- Object
- Hash
- Perseus::CorpusHash
- Includes:
- Hashie::Extensions::Coercion, Hashie::Extensions::IndifferentAccess, Hashie::Extensions::MergeInitializer, Hashie::Extensions::MethodAccess
- Defined in:
- lib/perseus/corpus_hash.rb
Instance Method Summary collapse
-
#initialize(hash = {}) ⇒ CorpusHash
constructor
A new instance of CorpusHash.
Constructor Details
#initialize(hash = {}) ⇒ CorpusHash
Returns a new instance of CorpusHash.
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/perseus/corpus_hash.rb', line 9 def initialize(hash = {}) super hash.each_pair do |k,v| if v.kind_of?(Array) self[k] = v.map { |v_i| CorpusHash.new(v_i) } elsif v.kind_of?(Hash) self[k] = CorpusHash.new v else self[k] = v end end end |