Class: Webhookdb::Message::Rendering

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

Constructor Details

#initialize(contents, exposed = {}) ⇒ Rendering

Returns a new instance of Rendering.



179
180
181
182
# File 'lib/webhookdb/message.rb', line 179

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



197
198
199
# File 'lib/webhookdb/message.rb', line 197

def method_missing(name, *, &)
  return self.contents.respond_to?(name) ? self.contents.send(name, *, &) : super
end

Instance Attribute Details

#contentsObject (readonly)

Returns the value of attribute contents.



177
178
179
# File 'lib/webhookdb/message.rb', line 177

def contents
  @contents
end

#exposedObject (readonly)

Returns the value of attribute exposed.



177
178
179
# File 'lib/webhookdb/message.rb', line 177

def exposed
  @exposed
end

Instance Method Details

#[](key) ⇒ Object



184
185
186
# File 'lib/webhookdb/message.rb', line 184

def [](key)
  return self.exposed[key]
end

#respond_to_missing?(name, *args) ⇒ Boolean

Returns:

  • (Boolean)


192
193
194
195
# File 'lib/webhookdb/message.rb', line 192

def respond_to_missing?(name, *args)
  return true if super
  return self.contents.respond_to?(name)
end

#to_sObject



188
189
190
# File 'lib/webhookdb/message.rb', line 188

def to_s
  return self.contents
end