Class: Broadway::Layout
- Inherits:
-
Object
- Object
- Broadway::Layout
- Defined in:
- lib/broadway/resources/layout.rb
Instance Attribute Summary collapse
-
#action ⇒ Object
Returns the value of attribute action.
-
#file ⇒ Object
Returns the value of attribute file.
-
#resource ⇒ Object
Returns the value of attribute resource.
Instance Method Summary collapse
-
#initialize(attributes) ⇒ Layout
constructor
A new instance of Layout.
- #kind ⇒ Object
- #template(theme = "") ⇒ Object
Constructor Details
#initialize(attributes) ⇒ Layout
Returns a new instance of Layout.
5 6 7 |
# File 'lib/broadway/resources/layout.rb', line 5 def initialize(attributes) end |
Instance Attribute Details
#action ⇒ Object
Returns the value of attribute action.
3 4 5 |
# File 'lib/broadway/resources/layout.rb', line 3 def action @action end |
#file ⇒ Object
Returns the value of attribute file.
3 4 5 |
# File 'lib/broadway/resources/layout.rb', line 3 def file @file end |
#resource ⇒ Object
Returns the value of attribute resource.
3 4 5 |
# File 'lib/broadway/resources/layout.rb', line 3 def resource @resource end |
Instance Method Details
#kind ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/broadway/resources/layout.rb', line 20 def kind if file.extension =~ /(haml|erb)/ $1 else "file" end end |
#template(theme = "") ⇒ Object
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/broadway/resources/layout.rb', line 9 def template(theme = "") # first check if it's in the posts directory (where textile files are) path = File.join(file.directory, action).squeeze("/") exists = false extensions = %w(html haml erb html.haml html.erb) extensions.each do |ext| exists = true if File.exists?("#{path}.#{ext}") end path if exists end |