class LayoutHelperGenerator
Public Instance Methods
copy_template_file()
click to toggle source
# File lib/generators/layout_helper/layout_helper_generator.rb, line 13 def copy_template_file generate "helper", "Layout" add_title_method add_description_method end
Private Instance Methods
add_description_method()
click to toggle source
# File lib/generators/layout_helper/layout_helper_generator.rb, line 41 def add_description_method inject_into_file(file_path, after: "module LayoutHelper\n") do <<-RUBY def description(value = nil) if value @description = value else @description.to_s end end RUBY end end
add_title_method()
click to toggle source
# File lib/generators/layout_helper/layout_helper_generator.rb, line 26 def add_title_method inject_into_file(file_path, after: "module LayoutHelper\n") do <<-RUBY def title(value = nil) if value @title = value else @title.to_s end end RUBY end end
file_path()
click to toggle source
# File lib/generators/layout_helper/layout_helper_generator.rb, line 22 def file_path Rails.root.join('app', 'helpers', "layout_helper.rb") end