Class: Rails::Generator::Commands::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/startups.rb

Instance Method Summary collapse

Instance Method Details

#route_code(route_options) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/startups.rb', line 12

def route_code(route_options)
  if route_options.is_a? Hash
    "map.#{route_options[:name]} '#{route_options[:name]}', :controller => '#{route_options[:controller]}', :action => '#{route_options[:action]}'"
  else
    route_options.to_s.gsub("\n    ","\n").strip
  end
end

#route_code_log_message(route_options) ⇒ Object



19
20
21
22
23
24
25
26
# File 'lib/startups.rb', line 19

def route_code_log_message(route_options)
  code = route_code(route_options)
  if code.index "\n"
    code = code[0,code.index("\n")]
    code = "#{code} ... end" if code.index ' do '
  end
  code
end