Class: Drift::BlogPost
- Inherits:
-
StaticModel
- Object
- StaticModel
- Drift::BlogPost
- Defined in:
- app/models/drift/blog_post.rb
Instance Attribute Summary collapse
-
#author ⇒ Object
Returns the value of attribute author.
-
#content ⇒ Object
Returns the value of attribute content.
-
#date ⇒ Object
Returns the value of attribute date.
-
#slug ⇒ Object
Returns the value of attribute slug.
-
#title ⇒ Object
Returns the value of attribute title.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(args) ⇒ BlogPost
constructor
A new instance of BlogPost.
Methods inherited from StaticModel
Constructor Details
#initialize(args) ⇒ BlogPost
Returns a new instance of BlogPost.
15 16 17 18 |
# File 'app/models/drift/blog_post.rb', line 15 def initialize(args) super set_attributes_from_file args[:file] end |
Instance Attribute Details
#author ⇒ Object
Returns the value of attribute author.
5 6 7 |
# File 'app/models/drift/blog_post.rb', line 5 def @author end |
#content ⇒ Object
Returns the value of attribute content.
5 6 7 |
# File 'app/models/drift/blog_post.rb', line 5 def content @content end |
#date ⇒ Object
Returns the value of attribute date.
5 6 7 |
# File 'app/models/drift/blog_post.rb', line 5 def date @date end |
#slug ⇒ Object
Returns the value of attribute slug.
5 6 7 |
# File 'app/models/drift/blog_post.rb', line 5 def slug @slug end |
#title ⇒ Object
Returns the value of attribute title.
5 6 7 |
# File 'app/models/drift/blog_post.rb', line 5 def title @title end |
Class Method Details
.find_by_slug(slug) ⇒ Object
7 8 9 10 11 12 13 |
# File 'app/models/drift/blog_post.rb', line 7 def self.find_by_slug(slug) file = self.all_files.detect do |f| slug == parse_slug_from_file(f) end find_by_file(file) end |