Class: Yamload::Loader

Inherits:
Object
  • Object
show all
Defined in:
lib/yamload/loader.rb

Instance Method Summary collapse

Constructor Details

#initialize(file, dir = Yamload.dir) ⇒ Loader

Returns a new instance of Loader.



9
10
11
# File 'lib/yamload/loader.rb', line 9

def initialize(file, dir = Yamload.dir)
  @loader = Loading::Yaml.new(file, dir)
end

Instance Method Details

#contentObject



17
18
19
# File 'lib/yamload/loader.rb', line 17

def content
  @content ||= IceNine.deep_freeze(content_with_defaults)
end

#defaultsObject



35
36
37
# File 'lib/yamload/loader.rb', line 35

def defaults
  defaults_merger.defaults
end

#defaults=(defaults) ⇒ Object



31
32
33
# File 'lib/yamload/loader.rb', line 31

def defaults=(defaults)
  defaults_merger.defaults = defaults
end

#exist?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/yamload/loader.rb', line 13

def exist?
  @loader.exist?
end

#objObject



21
22
23
# File 'lib/yamload/loader.rb', line 21

def obj
  @immutable_obj ||= Conversion::Object.new(content).to_immutable
end

#reloadObject



25
26
27
28
29
# File 'lib/yamload/loader.rb', line 25

def reload
  @content = @immutable_obj = nil
  @loader.reload
  content
end