Class: RailsTwirp::ServiceMapper::Mapping

Inherits:
Object
  • Object
show all
Defined in:
lib/rails_twirp/mapper.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(to:, **options) ⇒ Mapping

Returns a new instance of Mapping.

Raises:

  • (ArgumentError)


10
11
12
13
14
# File 'lib/rails_twirp/mapper.rb', line 10

def initialize(to:, **options)
  controller, @action = split_to(to)
  @controller = add_controller_module(controller, options.delete(:module))
  raise ArgumentError, "Unknown argument #{options.keys.first}" unless options.empty?
end

Instance Attribute Details

#actionObject (readonly)

Returns the value of attribute action.



8
9
10
# File 'lib/rails_twirp/mapper.rb', line 8

def action
  @action
end

#controllerObject (readonly)

Returns the value of attribute controller.



8
9
10
# File 'lib/rails_twirp/mapper.rb', line 8

def controller
  @controller
end

Instance Method Details

#to_sObject



16
17
18
# File 'lib/rails_twirp/mapper.rb', line 16

def to_s
  "#{controller}##{action}"
end