class Mailgunner::Struct
Public Class Methods
new(hash = nil)
click to toggle source
# File lib/mailgunner/struct.rb, line 5 def initialize(hash = nil) @hash = hash || {} end
Public Instance Methods
==(other)
click to toggle source
# File lib/mailgunner/struct.rb, line 21 def ==(other) other.is_a?(self.class) && other.to_h == @hash end
[](key)
click to toggle source
# File lib/mailgunner/struct.rb, line 9 def [](key) @hash[key.to_s] end
[]=(key, value)
click to toggle source
# File lib/mailgunner/struct.rb, line 13 def []=(key, value) @hash[key] = value end
method_missing(name, *args)
click to toggle source
Calls superclass method
# File lib/mailgunner/struct.rb, line 29 def method_missing(name, *args) return @hash[name.to_s] if @hash.key?(name.to_s) super end
pretty_print(q)
click to toggle source
# File lib/mailgunner/struct.rb, line 35 def pretty_print(q) q.object_address_group(self) do q.seplist(@hash, lambda { q.text ',' }) do |key, value| q.breakable q.text key.to_s q.text '=' q.group(1) { q.breakable '' q.pp value } end end end
respond_to_missing?(name, include_all)
click to toggle source
# File lib/mailgunner/struct.rb, line 25 def respond_to_missing?(name, include_all) @hash.key?(name.to_s) end
to_h()
click to toggle source
# File lib/mailgunner/struct.rb, line 17 def to_h @hash end