Class: GryphonNest::LayoutFile
- Inherits:
-
Object
- Object
- GryphonNest::LayoutFile
- Defined in:
- lib/gryphon_nest/layout_file.rb
Overview
Wrapper class for operations performed on the layout.yaml file
Instance Method Summary collapse
- #content ⇒ String
- #exist? ⇒ Boolean
-
#initialize(path) ⇒ LayoutFile
constructor
A new instance of LayoutFile.
- #mtime ⇒ Time
Constructor Details
#initialize(path) ⇒ LayoutFile
Returns a new instance of LayoutFile.
7 8 9 10 11 |
# File 'lib/gryphon_nest/layout_file.rb', line 7 def initialize(path) @path = path @content = nil @last_mtime = Time.now end |
Instance Method Details
#content ⇒ String
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/gryphon_nest/layout_file.rb', line 24 def content mod_time = mtime if @content.nil? || mod_time > @last_mtime @content = @path.read @last_mtime = mod_time end @content end |
#exist? ⇒ Boolean
14 15 16 |
# File 'lib/gryphon_nest/layout_file.rb', line 14 def exist? @path.exist? end |
#mtime ⇒ Time
19 20 21 |
# File 'lib/gryphon_nest/layout_file.rb', line 19 def mtime @path.mtime end |