Sha256: 4773422fab123057c6fdd9c448ceae54810af1fa327cf61a71db9a9a7687c133

Contents?: true

Size: 224 Bytes

Versions: 16

Compression:

Stored size: 224 Bytes

Contents

class Hash
  def to_o
    JSON.parse to_json, object_class: OpenStruct
  end

  def to_os
    self.each_with_object(OpenStruct.new) do |(key, val), memo|
      memo[key] = val.is_a?(Hash) ? val.to_os : val
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
mkit-0.9.0 lib/mkit/config/initializers/001_hash.rb
mkit-0.8.0 lib/mkit/config/initializers/001_hash.rb
mkit-0.7.2 lib/mkit/config/initializers/001_hash.rb
mkit-0.7.1 lib/mkit/config/initializers/001_hash.rb
mkit-0.7.0 lib/mkit/config/initializers/001_hash.rb
mkit-0.6.3 lib/mkit/config/initializers/001_hash.rb
mkit-0.6.2 lib/mkit/config/initializers/001_hash.rb
mkit-0.6.1 lib/mkit/config/initializers/001_hash.rb
mkit-0.6.0 lib/mkit/config/initializers/001_hash.rb
mkit-0.5.0 lib/mkit/config/initializers/001_hash.rb
mkit-0.4.3 lib/mkit/config/initializers/001_hash.rb
mkit-0.4.2 lib/mkit/config/initializers/001_hash.rb
mkit-0.4.1 lib/mkit/config/initializers/001_hash.rb
mkit-0.4.0 lib/mkit/config/initializers/001_hash.rb
mkit-0.3.0 lib/mkit/config/initializers/001_hash.rb
mkit-0.2.0 lib/mkit/config/initializers/001_hash.rb