Class: Grape::Util::LazyValueHash

Inherits:
LazyValueEnumerable show all
Defined in:
lib/grape/util/lazy_value.rb

Direct Known Subclasses

EndpointConfiguration

Instance Attribute Summary

Attributes inherited from LazyValue

#access_keys

Instance Method Summary collapse

Methods inherited from LazyValueEnumerable

#[], #[]=, #fetch

Methods inherited from LazyValue

#evaluate_from, #lazy?, #reached_by, #to_s

Constructor Details

#initialize(hash) ⇒ LazyValueHash

Returns a new instance of LazyValueHash.



78
79
80
81
82
83
84
# File 'lib/grape/util/lazy_value.rb', line 78

def initialize(hash)
  super
  @value_hash = ActiveSupport::HashWithIndifferentAccess.new
  hash.each do |key, value|
    self[key] = value
  end
end

Instance Method Details

#evaluateObject



86
87
88
# File 'lib/grape/util/lazy_value.rb', line 86

def evaluate
  @value_hash.transform_values(&:evaluate)
end