Sha256: 1e02ce6cb5a847491d8029f1a3ec56d288fab8a654c093800fbcbbb322c64647

Contents?: true

Size: 492 Bytes

Versions: 1

Compression:

Stored size: 492 Bytes

Contents

require 'ostruct'

class Configature::Data < OpenStruct
  # == Class Methods ========================================================

  def self.hashify(data)
    case (data)
    when Configature::Data
      data.to_h
    when Array
      data.map do |v|
        hashify(v)
      end
    else
      data
    end
  end

  # == Instance Methods =====================================================

  def to_h
    super.map do |k, v|
      [ k, self.class.hashify(v) ]
    end.to_h
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
configature-0.3.7 lib/configature/data.rb