Class: Gryphon::LayoutFile
- Inherits:
-
Object
- Object
- Gryphon::LayoutFile
- Defined in:
- lib/gryphon/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/layout_file.rb', line 7 def initialize(path) @path = path @content = nil @last_mtime = Time.now end |
Instance Method Details
#content ⇒ String
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/gryphon/layout_file.rb', line 20 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 |
# File 'lib/gryphon/layout_file.rb', line 14 def exist? = @path.exist? |
#mtime ⇒ Time
17 |
# File 'lib/gryphon/layout_file.rb', line 17 def mtime = @path.mtime |