Class: Charming::Router::Route

Inherits:
Data
  • Object
show all
Defined in:
lib/charming/router.rb

Overview

Route is a Data object holding a route’s path template, target controller/action, title, and resolved params.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#actionObject (readonly)

Returns the value of attribute action

Returns:

  • (Object)

    the current value of action



10
11
12
# File 'lib/charming/router.rb', line 10

def action
  @action
end

#controller_classObject (readonly)

Returns the value of attribute controller_class

Returns:

  • (Object)

    the current value of controller_class



10
11
12
# File 'lib/charming/router.rb', line 10

def controller_class
  @controller_class
end

#paramsObject (readonly)

Returns the value of attribute params

Returns:

  • (Object)

    the current value of params



10
11
12
# File 'lib/charming/router.rb', line 10

def params
  @params
end

#pathObject (readonly)

Returns the value of attribute path

Returns:

  • (Object)

    the current value of path



10
11
12
# File 'lib/charming/router.rb', line 10

def path
  @path
end

#titleObject (readonly)

Returns the value of attribute title

Returns:

  • (Object)

    the current value of title



10
11
12
# File 'lib/charming/router.rb', line 10

def title
  @title
end

Instance Method Details

#with_params(params) ⇒ Object



11
12
13
14
15
16
17
18
19
# File 'lib/charming/router.rb', line 11

def with_params(params)
  self.class.new(
    path: path,
    controller_class: controller_class,
    action: action,
    title: title,
    params: params
  )
end