Class: Shackleton::Fragment

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/shackleton/fragment.rb

Instance Method Summary collapse

Constructor Details

#initialize(route, arguments) ⇒ Fragment

Returns a new instance of Fragment.



7
8
9
10
# File 'lib/shackleton/fragment.rb', line 7

def initialize(route, arguments)
  @route = route
  @arguments = arguments
end

Instance Method Details

#argumentsObject



16
17
18
# File 'lib/shackleton/fragment.rb', line 16

def arguments
  @arguments.slice(*@route.named_fragments)
end

#callObject



12
13
14
# File 'lib/shackleton/fragment.rb', line 12

def call
  @route.expand(arguments)
end

#query_paramsObject



20
21
22
# File 'lib/shackleton/fragment.rb', line 20

def query_params
  @arguments.except(*@route.named_fragments)
end