Class: JekyllReact::PageData
- Inherits:
-
Object
- Object
- JekyllReact::PageData
- Defined in:
- lib/jekyll_react/page-data.rb
Instance Attribute Summary collapse
-
#page ⇒ Object
readonly
Returns the value of attribute page.
-
#site ⇒ Object
readonly
Returns the value of attribute site.
Instance Method Summary collapse
- #full_path ⇒ Object
- #full_url ⇒ Object
-
#initialize(site, page) ⇒ PageData
constructor
A new instance of PageData.
- #site_url ⇒ Object
- #title ⇒ Object
- #to_hash ⇒ Object
Constructor Details
#initialize(site, page) ⇒ PageData
Returns a new instance of PageData.
5 6 7 8 |
# File 'lib/jekyll_react/page-data.rb', line 5 def initialize(site, page) @site = site @page = page end |
Instance Attribute Details
#page ⇒ Object (readonly)
Returns the value of attribute page.
3 4 5 |
# File 'lib/jekyll_react/page-data.rb', line 3 def page @page end |
#site ⇒ Object (readonly)
Returns the value of attribute site.
3 4 5 |
# File 'lib/jekyll_react/page-data.rb', line 3 def site @site end |
Instance Method Details
#full_path ⇒ Object
23 24 25 26 |
# File 'lib/jekyll_react/page-data.rb', line 23 def full_path build_path = [self.full_url, self.title].join "#{build_path}.json" end |
#full_url ⇒ Object
18 19 20 21 |
# File 'lib/jekyll_react/page-data.rb', line 18 def full_url url_build = [self.site_url, self.site.baseurl].join [url_build, self.page.url].join end |
#site_url ⇒ Object
14 15 16 |
# File 'lib/jekyll_react/page-data.rb', line 14 def site_url self.site.config['url'] end |
#title ⇒ Object
10 11 12 |
# File 'lib/jekyll_react/page-data.rb', line 10 def title self.page.data['title'] end |
#to_hash ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/jekyll_react/page-data.rb', line 28 def to_hash data_hash = {} data_hash = data_hash.merge({ title: self.title, site_url: self.site_url, base_url: self.site.baseurl, rel_path: self.page.url, full_url: self.full_url, full_path: self.full_path, body: self.page.content, meta: self.page.data }) end |