Class: Glue::Template::Meta
- Inherits:
-
Object
- Object
- Glue::Template::Meta
- Defined in:
- lib/glue/template/meta.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#content ⇒ Object
Returns the value of attribute content.
-
#data ⇒ Object
Returns the value of attribute data.
Instance Method Summary collapse
-
#initialize(path) ⇒ Meta
constructor
A new instance of Meta.
- #process! ⇒ Object
Constructor Details
#initialize(path) ⇒ Meta
Returns a new instance of Meta.
8 9 10 11 12 |
# File 'lib/glue/template/meta.rb', line 8 def initialize(path) self.data = {} self.body = File.read(path) process! end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
5 6 7 |
# File 'lib/glue/template/meta.rb', line 5 def body @body end |
#content ⇒ Object
Returns the value of attribute content.
6 7 8 |
# File 'lib/glue/template/meta.rb', line 6 def content @content end |
#data ⇒ Object
Returns the value of attribute data.
4 5 6 |
# File 'lib/glue/template/meta.rb', line 4 def data @data end |
Instance Method Details
#process! ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/glue/template/meta.rb', line 14 def process! self.content = body.gsub /^\/ *(.*?): *(.*?) *$/sm do |m| data[$1] = $2 "" end self.data.symbolize_keys! end |