Class: Waffle::Maker::Route

Inherits:
Object
  • Object
show all
Defined in:
lib/waffle/maker/route.rb

Defined Under Namespace

Classes: Rails

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path_position, silent_error) ⇒ Route

Returns a new instance of Route.



10
11
12
13
# File 'lib/waffle/maker/route.rb', line 10

def initialize(path_position, silent_error)
  self.path_position = path_position
  self.silent_error = silent_error
end

Instance Attribute Details

#path_positionObject

Returns the value of attribute path_position.



8
9
10
# File 'lib/waffle/maker/route.rb', line 8

def path_position
  @path_position
end

#silent_errorObject

Returns the value of attribute silent_error.



8
9
10
# File 'lib/waffle/maker/route.rb', line 8

def silent_error
  @silent_error
end

Instance Method Details

#allObject



15
16
17
# File 'lib/waffle/maker/route.rb', line 15

def all
  defined?(::Rails) ? rails : default
end

#defaultObject



26
27
28
# File 'lib/waffle/maker/route.rb', line 26

def default
  []
end

#pathsObject



19
20
21
22
23
# File 'lib/waffle/maker/route.rb', line 19

def paths
  all.each.with_object([]) do |v, o|
    o << v[path_position].gsub(/\(\.:format\)$/, "")
  end
end