Sha256: e32b7db7d29249ad21f3bfa371fe6ab7697a5c916cfc66efd723c65883a7e326
Contents?: true
Size: 668 Bytes
Versions: 119
Compression:
Stored size: 668 Bytes
Contents
class Promethee::Data def initialize(data) @data = hashify data end def data @data end # The class creates a facade in front of the real hash, therefore include?, [] and to_json are delegated def include?(value) @data.include? value end def [](value) @data[value] end def to_json @data.to_json end protected def hashify(data) # https://github.com/bbatsov/ruby-style-guide#indent-conditional-assignment h = case data.class.to_s when 'Hash', 'ActiveSupport::HashWithIndifferentAccess' then data when 'String' then JSON.parse data else {} end h.deep_symbolize_keys end end
Version data entries
119 entries across 119 versions & 1 rubygems