class Promethee::Data
Public Class Methods
new(data)
click to toggle source
# File lib/promethee/data.rb, line 2 def initialize(data) @data = hashify data end
Public Instance Methods
[](value)
click to toggle source
# File lib/promethee/data.rb, line 15 def [](value) @data[value] end
data()
click to toggle source
# File lib/promethee/data.rb, line 6 def data @data end
include?(value)
click to toggle source
The class creates a facade in front of the real hash, therefore include?, [] and to_json
are delegated
# File lib/promethee/data.rb, line 11 def include?(value) @data.include? value end
to_json()
click to toggle source
# File lib/promethee/data.rb, line 19 def to_json @data.to_json end
Protected Instance Methods
hashify(data)
click to toggle source
# File lib/promethee/data.rb, line 25 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