Class: Asciidoctor::Standoc::YamlContextRenderer
- Inherits:
-
Object
- Object
- Asciidoctor::Standoc::YamlContextRenderer
- Defined in:
- lib/asciidoctor/standoc/macros_yaml2text.rb
Instance Attribute Summary collapse
-
#context_name ⇒ Object
readonly
Returns the value of attribute context_name.
-
#context_object ⇒ Object
readonly
Returns the value of attribute context_object.
Instance Method Summary collapse
-
#initialize(context_object:, context_name:) ⇒ YamlContextRenderer
constructor
A new instance of YamlContextRenderer.
- #method_missing(name, *_args) ⇒ Object
- #render(template) ⇒ Object
- #respond_to_missing?(name) ⇒ Boolean
Constructor Details
#initialize(context_object:, context_name:) ⇒ YamlContextRenderer
Returns a new instance of YamlContextRenderer.
28 29 30 31 |
# File 'lib/asciidoctor/standoc/macros_yaml2text.rb', line 28 def initialize(context_object:, context_name:) @context_object = context_object @context_name = context_name end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *_args) ⇒ Object
37 38 39 40 41 |
# File 'lib/asciidoctor/standoc/macros_yaml2text.rb', line 37 def method_missing(name, *_args) return context_object if name.to_s == context_name super end |
Instance Attribute Details
#context_name ⇒ Object (readonly)
Returns the value of attribute context_name.
26 27 28 |
# File 'lib/asciidoctor/standoc/macros_yaml2text.rb', line 26 def context_name @context_name end |
#context_object ⇒ Object (readonly)
Returns the value of attribute context_object.
26 27 28 |
# File 'lib/asciidoctor/standoc/macros_yaml2text.rb', line 26 def context_object @context_object end |
Instance Method Details
#render(template) ⇒ Object
43 44 45 |
# File 'lib/asciidoctor/standoc/macros_yaml2text.rb', line 43 def render(template) ERB.new(template).result(binding) end |
#respond_to_missing?(name) ⇒ Boolean
33 34 35 |
# File 'lib/asciidoctor/standoc/macros_yaml2text.rb', line 33 def respond_to_missing?(name) respond_to?(name) end |