class Grape::Router::AttributeTranslator
this could be an OpenStruct, but doesn't work in Ruby 2.3.0, see bugs.ruby-lang.org/issues/12251
Public Class Methods
new(attributes = {})
click to toggle source
# File lib/grape/router/attribute_translator.rb, line 5 def initialize(attributes = {}) @attributes = attributes end
Public Instance Methods
method_missing(m, *args)
click to toggle source
# File lib/grape/router/attribute_translator.rb, line 13 def method_missing(m, *args) if m[-1] == '=' @attributes[m[0..-1]] = *args elsif m[-1] != '=' @attributes[m] end end
respond_to_missing?(method_name, _include_private = false)
click to toggle source
# File lib/grape/router/attribute_translator.rb, line 21 def respond_to_missing?(method_name, _include_private = false) if method_name[-1] == '=' true else @attributes.key?(method_name) end end
to_h()
click to toggle source
# File lib/grape/router/attribute_translator.rb, line 9 def to_h @attributes end