Class: LowVoltage::Post
- Inherits:
-
Object
- Object
- LowVoltage::Post
- Defined in:
- lib/low_voltage/post.rb
Instance Attribute Summary collapse
-
#author ⇒ Object
readonly
Returns the value of attribute author.
-
#content ⇒ Object
readonly
Returns the value of attribute content.
-
#date ⇒ Object
readonly
Returns the value of attribute date.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Instance Method Summary collapse
-
#initialize(path) ⇒ Post
constructor
A new instance of Post.
Constructor Details
#initialize(path) ⇒ Post
Returns a new instance of Post.
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/low_voltage/post.rb', line 7 def initialize(path) @id = File.basename(path, ".md") @path = path begin parse_post(Metadown.render(IO.read(@path))) rescue Errno::ENOENT raise ActionController::RoutingError, "Post not found: #{path}" end end |
Instance Attribute Details
#author ⇒ Object (readonly)
Returns the value of attribute author.
5 6 7 |
# File 'lib/low_voltage/post.rb', line 5 def @author end |
#content ⇒ Object (readonly)
Returns the value of attribute content.
5 6 7 |
# File 'lib/low_voltage/post.rb', line 5 def content @content end |
#date ⇒ Object (readonly)
Returns the value of attribute date.
5 6 7 |
# File 'lib/low_voltage/post.rb', line 5 def date @date end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
5 6 7 |
# File 'lib/low_voltage/post.rb', line 5 def id @id end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
5 6 7 |
# File 'lib/low_voltage/post.rb', line 5 def title @title end |