Class: Smithy::PageProxy
- Inherits:
-
Object
- Object
- Smithy::PageProxy
- Defined in:
- app/models/smithy/page_proxy.rb
Instance Attribute Summary collapse
-
#browser_title ⇒ Object
Returns the value of attribute browser_title.
-
#description ⇒ Object
Returns the value of attribute description.
-
#id ⇒ Object
Returns the value of attribute id.
-
#keywords ⇒ Object
Returns the value of attribute keywords.
-
#path ⇒ Object
Returns the value of attribute path.
-
#title ⇒ Object
Returns the value of attribute title.
Instance Method Summary collapse
- #add_to_container(container_name, content) ⇒ Object
- #containers ⇒ Object
-
#initialize(attributes = {}) ⇒ PageProxy
constructor
A new instance of PageProxy.
- #site ⇒ Object
- #to_liquid ⇒ Object
Constructor Details
#initialize(attributes = {}) ⇒ PageProxy
Returns a new instance of PageProxy.
26 27 28 29 30 31 |
# File 'app/models/smithy/page_proxy.rb', line 26 def initialize(attributes = {}) @containers = {} [:id, :browser_title, :title, :path, :keywords, :description].each do |k| self.send("#{k}=".to_sym, attributes[k]) if attributes[k].present? end end |
Instance Attribute Details
#browser_title ⇒ Object
Returns the value of attribute browser_title.
24 25 26 |
# File 'app/models/smithy/page_proxy.rb', line 24 def browser_title @browser_title end |
#description ⇒ Object
Returns the value of attribute description.
24 25 26 |
# File 'app/models/smithy/page_proxy.rb', line 24 def description @description end |
#id ⇒ Object
Returns the value of attribute id.
24 25 26 |
# File 'app/models/smithy/page_proxy.rb', line 24 def id @id end |
#keywords ⇒ Object
Returns the value of attribute keywords.
24 25 26 |
# File 'app/models/smithy/page_proxy.rb', line 24 def keywords @keywords end |
#path ⇒ Object
Returns the value of attribute path.
24 25 26 |
# File 'app/models/smithy/page_proxy.rb', line 24 def path @path end |
#title ⇒ Object
Returns the value of attribute title.
24 25 26 |
# File 'app/models/smithy/page_proxy.rb', line 24 def title @title end |
Instance Method Details
#add_to_container(container_name, content) ⇒ Object
41 42 43 44 45 |
# File 'app/models/smithy/page_proxy.rb', line 41 def add_to_container(container_name, content) @containers[container_name.to_s] ||= '' @containers[container_name.to_s] << content @containers end |
#containers ⇒ Object
37 38 39 |
# File 'app/models/smithy/page_proxy.rb', line 37 def containers @containers end |
#site ⇒ Object
47 48 49 |
# File 'app/models/smithy/page_proxy.rb', line 47 def site @site ||= Smithy::Site.instance end |
#to_liquid ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 |
# File 'app/models/smithy/page_proxy.rb', line 51 def to_liquid { 'id' => self.id, 'browser_title' => (self.browser_title.present? ? self.browser_title : self.title), 'title' => title, 'path' => path, 'meta_description' => description, 'meta_keywords' => keywords, 'container' => containers } end |