Class: Madman::YAMLDoc
- Inherits:
-
Object
- Object
- Madman::YAMLDoc
- Defined in:
- lib/madman/yamldoc.rb
Instance Attribute Summary collapse
-
#title ⇒ Object
readonly
Returns the value of attribute title.
-
#yaml ⇒ Object
readonly
Returns the value of attribute yaml.
Instance Method Summary collapse
-
#initialize(yaml, title: nil) ⇒ YAMLDoc
constructor
A new instance of YAMLDoc.
- #render ⇒ Object
- #slim ⇒ Object
- #slim_options ⇒ Object
- #template ⇒ Object
- #tree ⇒ Object
Constructor Details
#initialize(yaml, title: nil) ⇒ YAMLDoc
Returns a new instance of YAMLDoc.
11 12 13 14 |
# File 'lib/madman/yamldoc.rb', line 11 def initialize(yaml, title: nil) @yaml = yaml @title = title end |
Instance Attribute Details
#title ⇒ Object (readonly)
Returns the value of attribute title.
9 10 11 |
# File 'lib/madman/yamldoc.rb', line 9 def title @title end |
#yaml ⇒ Object (readonly)
Returns the value of attribute yaml.
9 10 11 |
# File 'lib/madman/yamldoc.rb', line 9 def yaml @yaml end |
Instance Method Details
#render ⇒ Object
16 17 18 |
# File 'lib/madman/yamldoc.rb', line 16 def render slim.render self end |
#slim ⇒ Object
24 25 26 |
# File 'lib/madman/yamldoc.rb', line 24 def slim @slim ||= Slim::Template.new template, end |
#slim_options ⇒ Object
28 29 30 |
# File 'lib/madman/yamldoc.rb', line 28 def { pretty: true, disable_escape: true } end |
#template ⇒ Object
20 21 22 |
# File 'lib/madman/yamldoc.rb', line 20 def template File. '../views/yamldoc.slim', __dir__ end |
#tree ⇒ Object
32 33 34 |
# File 'lib/madman/yamldoc.rb', line 32 def tree @tree ||= tree! end |