Class: Arigato::View
- Inherits:
-
Object
- Object
- Arigato::View
- Defined in:
- lib/arigato/view.rb
Constant Summary collapse
- TITLE =
'Special Thanks'
Instance Attribute Summary collapse
-
#layout ⇒ Object
Returns the value of attribute layout.
-
#specs ⇒ Object
Returns the value of attribute specs.
-
#theme ⇒ Object
Returns the value of attribute theme.
-
#title ⇒ Object
Returns the value of attribute title.
Class Method Summary collapse
Instance Method Summary collapse
- #content ⇒ Object
- #content_file ⇒ Object
- #content_for(title = nil) ⇒ Object
- #erb(path) ⇒ Object
-
#initialize(theme, gemfile = './Gemfile', layout = true) ⇒ View
constructor
A new instance of View.
- #layout_file ⇒ Object
- #link_to(label, href, target = '_blank') ⇒ Object
- #render ⇒ Object
- #render_with_layout ⇒ Object
- #render_without_layout ⇒ Object
- #theme_dir ⇒ Object
Constructor Details
Instance Attribute Details
#layout ⇒ Object
Returns the value of attribute layout.
8 9 10 |
# File 'lib/arigato/view.rb', line 8 def layout @layout end |
#specs ⇒ Object
Returns the value of attribute specs.
8 9 10 |
# File 'lib/arigato/view.rb', line 8 def specs @specs end |
#theme ⇒ Object
Returns the value of attribute theme.
8 9 10 |
# File 'lib/arigato/view.rb', line 8 def theme @theme end |
#title ⇒ Object
Returns the value of attribute title.
8 9 10 |
# File 'lib/arigato/view.rb', line 8 def title @title end |
Class Method Details
.author(spec) ⇒ Object
62 63 64 |
# File 'lib/arigato/view.rb', line 62 def self.(spec) spec. ? "by #{spec.}" : '' end |
Instance Method Details
#content ⇒ Object
29 30 31 |
# File 'lib/arigato/view.rb', line 29 def content erb(content_file).result(binding) end |
#content_file ⇒ Object
47 48 49 |
# File 'lib/arigato/view.rb', line 47 def content_file file('content') end |
#content_for(title = nil) ⇒ Object
59 60 |
# File 'lib/arigato/view.rb', line 59 def content_for(title = nil) end |
#erb(path) ⇒ Object
37 38 39 40 41 |
# File 'lib/arigato/view.rb', line 37 def erb(path) erb = ERB.new(File.read(path), nil, '-') erb.filename = path erb end |
#layout_file ⇒ Object
51 52 53 |
# File 'lib/arigato/view.rb', line 51 def layout_file file('layout') end |
#link_to(label, href, target = '_blank') ⇒ Object
55 56 57 |
# File 'lib/arigato/view.rb', line 55 def link_to(label, href, target = '_blank') %!<a href="#{href}" target="#{target}">#{label}</a>! end |
#render ⇒ Object
17 18 19 |
# File 'lib/arigato/view.rb', line 17 def render @layout ? render_with_layout : render_without_layout end |
#render_with_layout ⇒ Object
25 26 27 |
# File 'lib/arigato/view.rb', line 25 def render_with_layout layout end |
#render_without_layout ⇒ Object
21 22 23 |
# File 'lib/arigato/view.rb', line 21 def render_without_layout content end |
#theme_dir ⇒ Object
43 44 45 |
# File 'lib/arigato/view.rb', line 43 def theme_dir Pathname.new(File.join(Arigato.themes_dir, theme)) end |