class Nanoc::Core::ConfigView
Public Class Methods
new(config, context)
click to toggle source
@api private
Calls superclass method
Nanoc::Core::View::new
# File lib/nanoc/core/config_view.rb, line 7 def initialize(config, context) super(context) @config = config end
Public Instance Methods
[](key)
click to toggle source
@see Hash#[]
# File lib/nanoc/core/config_view.rb, line 43 def [](key) @context.dependency_tracker.bounce(_unwrap, attributes: [key]) @config[key] end
_unwrap()
click to toggle source
@api private
# File lib/nanoc/core/config_view.rb, line 13 def _unwrap @config end
dig(*keys)
click to toggle source
@see Hash#dig
# File lib/nanoc/core/config_view.rb, line 61 def dig(*keys) @context.dependency_tracker.bounce(_unwrap, attributes: keys.take(1)) @config.dig(*keys) end
each(&block)
click to toggle source
@see Hash#each
# File lib/nanoc/core/config_view.rb, line 49 def each(&block) @context.dependency_tracker.bounce(_unwrap, attributes: true) @config.each(&block) end
env_name()
click to toggle source
# File lib/nanoc/core/config_view.rb, line 55 def env_name @context.dependency_tracker.bounce(_unwrap, attributes: true) @config.env_name end
fetch(key, fallback = Nanoc::Core::UNDEFINED) { |key| ... }
click to toggle source
@see Hash#fetch
# File lib/nanoc/core/config_view.rb, line 23 def fetch(key, fallback = Nanoc::Core::UNDEFINED, &_block) @context.dependency_tracker.bounce(_unwrap, attributes: [key]) @config.fetch(key) do if !Nanoc::Core::UNDEFINED.equal?(fallback) fallback elsif block_given? yield(key) else raise KeyError, "key not found: #{key.inspect}" end end end
key?(key)
click to toggle source
@see Hash#key?
# File lib/nanoc/core/config_view.rb, line 37 def key?(key) @context.dependency_tracker.bounce(_unwrap, attributes: [key]) @config.key?(key) end
output_dir()
click to toggle source
@api private
# File lib/nanoc/core/config_view.rb, line 18 def output_dir @config.output_dir end