Class: Waw::Routing::DSL

Inherits:
Object show all
Defined in:
lib/waw/routing/dsl.rb

Overview

The DSL for routing blocks

Instance Method Summary collapse

Constructor Details

#initialize(routing) ⇒ DSL

Creates a DSL instance for some routing instance



7
8
9
# File 'lib/waw/routing/dsl.rb', line 7

def initialize(routing)
  @routing = routing
end

Instance Method Details

#feedback(*args) ⇒ Object

Feedback routing execution



19
20
21
# File 'lib/waw/routing/dsl.rb', line 19

def feedback(*args)
  Waw::Routing::Feedback.new(*args)
end

#form_validation_feedback(*args) ⇒ Object

Form validation feedback routing execution



24
25
26
# File 'lib/waw/routing/dsl.rb', line 24

def form_validation_feedback(*args)
  Waw::Routing::FormValidationFeedback.new(*args)
end

#javascript(*args) ⇒ Object

Javascript routing execution



39
40
41
# File 'lib/waw/routing/dsl.rb', line 39

def javascript(*args)
  Waw::Routing::Javascript.new(*args)
end

#redirect(*args) ⇒ Object

Redirect routing execution



34
35
36
# File 'lib/waw/routing/dsl.rb', line 34

def redirect(*args)
  Waw::Routing::Redirect.new(*args)
end

#refresh(*args) ⇒ Object

Refresh routing execution



29
30
31
# File 'lib/waw/routing/dsl.rb', line 29

def refresh(*args)
  Waw::Routing::Refresh.new(*args)
end

#upon(*action_results) ⇒ Object

Evaluates the block as routing execution and installs it under all provided action results

Raises:

  • (ArgumentError)


13
14
15
16
# File 'lib/waw/routing/dsl.rb', line 13

def upon(*action_results)
  raise ArgumentError, "Missing routing block on upon", caller unless block_given?
  @routing.add_rules(action_results, yield)
end