Class: RailsUpgrade::Upgraders::FakeNamespace
- Inherits:
-
RouteObject
- Object
- RouteObject
- RailsUpgrade::Upgraders::FakeNamespace
- Defined in:
- lib/rails-upgrade/upgraders/routes.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#routes ⇒ Object
Returns the value of attribute routes.
Instance Method Summary collapse
- #<<(val) ⇒ Object
-
#initialize(name) ⇒ FakeNamespace
constructor
A new instance of FakeNamespace.
- #last ⇒ Object
- #to_route_code ⇒ Object
Methods inherited from RouteObject
#indent_lines, #opts_to_string
Constructor Details
#initialize(name) ⇒ FakeNamespace
Returns a new instance of FakeNamespace.
157 158 159 160 161 |
# File 'lib/rails-upgrade/upgraders/routes.rb', line 157 def initialize(name) @routes = [] @name = name @indent = RouteRedrawer.indent end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
155 156 157 |
# File 'lib/rails-upgrade/upgraders/routes.rb', line 155 def name @name end |
#routes ⇒ Object
Returns the value of attribute routes.
155 156 157 |
# File 'lib/rails-upgrade/upgraders/routes.rb', line 155 def routes @routes end |
Instance Method Details
#<<(val) ⇒ Object
169 170 171 |
# File 'lib/rails-upgrade/upgraders/routes.rb', line 169 def <<(val) @routes << val end |
#last ⇒ Object
173 174 175 |
# File 'lib/rails-upgrade/upgraders/routes.rb', line 173 def last @routes.last end |
#to_route_code ⇒ Object
163 164 165 166 167 |
# File 'lib/rails-upgrade/upgraders/routes.rb', line 163 def to_route_code lines = ["namespace :#{@name} do", @routes.map {|r| r.to_route_code}, "end"] indent_lines(lines) end |