Module: ActivesupportOverride
- Included in:
- Generator::Context
- Defined in:
- lib/generator/helper/activesupport_override.rb
Instance Method Summary collapse
- #external_path?(path) ⇒ Boolean
- #javascript_include_tag(path) ⇒ Object
- #link_tag(source, relation, type = '') ⇒ Object
- #meta_tag(type, content) ⇒ Object
- #meta_tag_http(type, content) ⇒ Object
- #path_to_css(path) ⇒ Object
- #path_to_image(path) ⇒ Object
- #path_to_js(path) ⇒ Object
- #stylesheet_link_tag(path, media = 'screen') ⇒ Object
- #url_for(options = '') ⇒ Object
Instance Method Details
#external_path?(path) ⇒ Boolean
41 42 43 |
# File 'lib/generator/helper/activesupport_override.rb', line 41 def external_path? path path.start_with?('//') || path.start_with?('http') end |
#javascript_include_tag(path) ⇒ Object
6 7 8 |
# File 'lib/generator/helper/activesupport_override.rb', line 6 def javascript_include_tag(path) '<script src="'+path_to_js(path)+'"></script>' end |
#link_tag(source, relation, type = '') ⇒ Object
18 19 20 21 |
# File 'lib/generator/helper/activesupport_override.rb', line 18 def link_tag(source, relation, type='') type = " type='#{type}'" if type '<link rel="'+relation+'" href="'+source+'"'+type+'/>' end |
#meta_tag(type, content) ⇒ Object
10 11 12 |
# File 'lib/generator/helper/activesupport_override.rb', line 10 def (type, content) '<meta name="'+type+'" content="'+content+'" />' end |
#meta_tag_http(type, content) ⇒ Object
14 15 16 |
# File 'lib/generator/helper/activesupport_override.rb', line 14 def (type, content) '<meta http-equiv="'+type+'" content="'+content+'" />' end |
#path_to_css(path) ⇒ Object
23 24 25 26 27 |
# File 'lib/generator/helper/activesupport_override.rb', line 23 def path_to_css(path) return path if external_path?(path) return "css/#{path}" if file_exists? "css/#{path}" path end |
#path_to_image(path) ⇒ Object
35 36 37 38 39 |
# File 'lib/generator/helper/activesupport_override.rb', line 35 def path_to_image(path) return path if external_path? path return "images/#{path}" if file_exists? "images/#{path}" path end |
#path_to_js(path) ⇒ Object
29 30 31 32 33 |
# File 'lib/generator/helper/activesupport_override.rb', line 29 def path_to_js(path) return path if external_path? path return "js/#{path}" if file_exists? "js/#{path}" path end |
#stylesheet_link_tag(path, media = 'screen') ⇒ Object
2 3 4 |
# File 'lib/generator/helper/activesupport_override.rb', line 2 def stylesheet_link_tag(path, media='screen') '<link href="'+path_to_css(path)+'" media="'+media+'" rel="stylesheet" type="text/css" />' end |
#url_for(options = '') ⇒ Object
45 46 47 |
# File 'lib/generator/helper/activesupport_override.rb', line 45 def url_for( = '') return end |