Class: Yuriita::Collection

Inherits:
Object
  • Object
show all
Includes:
Routing
Defined in:
lib/yuriita/collection.rb,
lib/yuriita/errors/collection/action_not_found.rb

Defined Under Namespace

Classes: ActionNotFound

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(input) ⇒ Collection

Returns a new instance of Collection.



24
25
26
# File 'lib/yuriita/collection.rb', line 24

def initialize(input)
  @input = input
end

Instance Attribute Details

#inputObject (readonly)

Returns the value of attribute input.



5
6
7
# File 'lib/yuriita/collection.rb', line 5

def input
  @input
end

Class Method Details

.action_methodsObject



12
13
14
15
16
17
18
19
20
21
# File 'lib/yuriita/collection.rb', line 12

def action_methods
  @action_methods ||= begin
    internal_methods = superclass.public_instance_methods(true)
    methods = (public_instance_methods(true) - internal_methods)

    methods.map!(&:to_s)

    methods.to_set
  end
end

.dispatch(name, input, relation) ⇒ Object



8
9
10
# File 'lib/yuriita/collection.rb', line 8

def dispatch(name, input, relation)
  new(input).dispatch(name, relation)
end

Instance Method Details

#dispatch(name, relation) ⇒ Object



28
29
30
# File 'lib/yuriita/collection.rb', line 28

def dispatch(name, relation)
  process(name, relation)
end