class CaptainHoog::Struct
Public Instance Methods
fetch(key, default = nil)
click to toggle source
# File lib/captain_hoog/struct/hoog_struct.rb, line 4 def fetch(key, default = nil) if not self.respond_to?(key) raise IndexError unless default return default else self.public_send(key) end end
method_missing(method_name, *args, &block)
click to toggle source
Calls superclass method
# File lib/captain_hoog/struct/hoog_struct.rb, line 13 def method_missing(method_name, *args, &block) if self.to_h.respond_to?(method_name) self.to_h.stringify_keys.send(method_name.to_s, *args, &block) else super end end
respond_to_missing?(method_name, include_private = false)
click to toggle source
Calls superclass method
# File lib/captain_hoog/struct/hoog_struct.rb, line 21 def respond_to_missing?(method_name, include_private = false) self.to_h.respond_to?(method_name) || super end