Class: Webhookdb::Message::Rendering
- Inherits:
-
Object
- Object
- Webhookdb::Message::Rendering
- Defined in:
- lib/webhookdb/message.rb
Overview
String-like type representing the output of a rendering operation. Use [key] to access exposed variables, as per LiquidExpose
.
Instance Attribute Summary collapse
-
#contents ⇒ Object
readonly
Returns the value of attribute contents.
-
#exposed ⇒ Object
readonly
Returns the value of attribute exposed.
Instance Method Summary collapse
- #[](key) ⇒ Object
-
#initialize(contents, exposed = {}) ⇒ Rendering
constructor
A new instance of Rendering.
- #method_missing(name) ⇒ Object
- #respond_to_missing?(name, *args) ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize(contents, exposed = {}) ⇒ Rendering
Returns a new instance of Rendering.
128 129 130 131 |
# File 'lib/webhookdb/message.rb', line 128 def initialize(contents, exposed={}) @contents = contents @exposed = exposed end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name) ⇒ Object
146 147 148 |
# File 'lib/webhookdb/message.rb', line 146 def method_missing(name, *, &) return self.contents.respond_to?(name) ? self.contents.send(name, *, &) : super end |
Instance Attribute Details
#contents ⇒ Object (readonly)
Returns the value of attribute contents.
126 127 128 |
# File 'lib/webhookdb/message.rb', line 126 def contents @contents end |
#exposed ⇒ Object (readonly)
Returns the value of attribute exposed.
126 127 128 |
# File 'lib/webhookdb/message.rb', line 126 def exposed @exposed end |
Instance Method Details
#[](key) ⇒ Object
133 134 135 |
# File 'lib/webhookdb/message.rb', line 133 def [](key) return self.exposed[key] end |
#respond_to_missing?(name, *args) ⇒ Boolean
141 142 143 144 |
# File 'lib/webhookdb/message.rb', line 141 def respond_to_missing?(name, *args) return true if super return self.contents.respond_to?(name) end |
#to_s ⇒ Object
137 138 139 |
# File 'lib/webhookdb/message.rb', line 137 def to_s return self.contents end |