Class: Argible::ArgumentResolver

Inherits:
Object
  • Object
show all
Defined in:
lib/argible/argument_resolver.rb

Overview

This class defines the method/proc that will be called to resolve an arguments value. By default this implementation will resolve an arguments value through RoR’s request parameters. It is possible to plug-in an alternate resolver implementation like so (in the example all arguments values will resolve to the value ‘foobar’):

::Argible::ArgumentResolver.resolver = lambda do |instance, argument_name|
  return "foobar"
end

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.resolverObject

Returns the value of attribute resolver.



12
13
14
# File 'lib/argible/argument_resolver.rb', line 12

def resolver
  @resolver
end

Class Method Details

.resolve(object, argument_name) ⇒ Object



19
20
21
# File 'lib/argible/argument_resolver.rb', line 19

def self.resolve(object, argument_name)
  return @resolver.call(object, argument_name)
end