Class: Fronton::Page
- Inherits:
-
Object
- Object
- Fronton::Page
- Defined in:
- lib/fronton/page.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
- #content ⇒ Object
- #exist? ⇒ Boolean
-
#initialize(name, url) ⇒ Page
constructor
A new instance of Page.
- #save ⇒ Object
Constructor Details
#initialize(name, url) ⇒ Page
Returns a new instance of Page.
8 9 10 11 |
# File 'lib/fronton/page.rb', line 8 def initialize(name, url) @name = name @url = url end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/fronton/page.rb', line 6 def name @name end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
6 7 8 |
# File 'lib/fronton/page.rb', line 6 def url @url end |
Instance Method Details
#content ⇒ Object
13 14 15 |
# File 'lib/fronton/page.rb', line 13 def content Tilt.new(template_path, ).render(Fronton::Contexts::Tilt.new) end |
#exist? ⇒ Boolean
21 22 23 |
# File 'lib/fronton/page.rb', line 21 def exist? !template_path.nil? end |
#save ⇒ Object
17 18 19 |
# File 'lib/fronton/page.rb', line 17 def save File.open(save_path, 'w') { |f| f.write(content) } end |