class Yamload::Loader

Public Class Methods

new(file, dir = Yamload.dir) click to toggle source
# File lib/yamload/loader.rb, line 12
def initialize(file, dir = Yamload.dir)
  @loader = Loading::Yaml.new(file, dir)
end

Public Instance Methods

content() click to toggle source
# File lib/yamload/loader.rb, line 20
def content
  @content ||= IceNine.deep_freeze(content_with_defaults)
end
defaults() click to toggle source
# File lib/yamload/loader.rb, line 38
def defaults
  defaults_merger.defaults
end
defaults=(defaults) click to toggle source
# File lib/yamload/loader.rb, line 34
def defaults=(defaults)
  defaults_merger.defaults = defaults
end
exist?() click to toggle source
# File lib/yamload/loader.rb, line 16
def exist?
  @loader.exist?
end
obj() click to toggle source
# File lib/yamload/loader.rb, line 24
def obj
  @immutable_obj ||= Conversion::Object.new(content).to_immutable
end
reload() click to toggle source
# File lib/yamload/loader.rb, line 28
def reload
  @content = @immutable_obj = nil
  @loader.reload
  content
end

Private Instance Methods

content_with_defaults() click to toggle source
# File lib/yamload/loader.rb, line 44
def content_with_defaults
  defaults_merger.merge(@loader.content)
end
defaults_merger() click to toggle source
# File lib/yamload/loader.rb, line 48
def defaults_merger
  @defaults_merger ||= Defaults::Hash.new
end