Class: Amiba::Scope
- Inherits:
-
Object
- Object
- Amiba::Scope
- Defined in:
- lib/amiba/scope.rb
Instance Attribute Summary collapse
-
#page ⇒ Object
readonly
Returns the value of attribute page.
Instance Method Summary collapse
- #content ⇒ Object
- #description ⇒ Object
- #entries ⇒ Object
- #full_url(frag) ⇒ Object
-
#initialize(page) ⇒ Scope
constructor
A new instance of Scope.
- #partial(path, locals = {}) ⇒ Object
- #site_name ⇒ Object
- #site_url ⇒ Object
- #title ⇒ Object
Constructor Details
#initialize(page) ⇒ Scope
Returns a new instance of Scope.
6 7 8 |
# File 'lib/amiba/scope.rb', line 6 def initialize(page) @page = page end |
Instance Attribute Details
#page ⇒ Object (readonly)
Returns the value of attribute page.
4 5 6 |
# File 'lib/amiba/scope.rb', line 4 def page @page end |
Instance Method Details
#content ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/amiba/scope.rb', line 18 def content if @page.is_a? Amiba::Source::Page c = Amiba::Source::PageEntry.new(page) if c.new? Amiba::Tilt.new(@page).render(self) else Amiba::Tilt.new(@page).render(Amiba::Scope.new(c)) end else Amiba::Tilt.new(@page).render(self) end end |
#description ⇒ Object
14 15 16 |
# File 'lib/amiba/scope.rb', line 14 def description page.description end |
#entries ⇒ Object
31 32 33 |
# File 'lib/amiba/scope.rb', line 31 def entries Amiba::Source::Entry end |
#full_url(frag) ⇒ Object
48 49 50 51 52 53 54 |
# File 'lib/amiba/scope.rb', line 48 def full_url(frag) if site_url.empty? frag else URI.join(site_url, frag).to_s end end |
#partial(path, locals = {}) ⇒ Object
35 36 37 38 |
# File 'lib/amiba/scope.rb', line 35 def partial(path, locals={}) p = Amiba::Source::Partial.new path Amiba::Tilt.new(p.filename).render(Amiba::Scope.new(p), locals) end |
#site_name ⇒ Object
40 41 42 |
# File 'lib/amiba/scope.rb', line 40 def site_name Amiba::Configuration.site_name.nil? ? "" : Amiba::Configuration.site_name end |
#site_url ⇒ Object
44 45 46 |
# File 'lib/amiba/scope.rb', line 44 def site_url Amiba::Configuration.site_name.nil? ? "" : "http://#{Amiba::Configuration.site_name}/" end |
#title ⇒ Object
10 11 12 |
# File 'lib/amiba/scope.rb', line 10 def title page.title end |