Module: ActivesupportOverride

Included in:
Generator::Context
Defined in:
lib/generator/helper/activesupport_override.rb

Instance Method Summary collapse

Instance Method Details

#external_path?(path) ⇒ Boolean

Returns:

  • (Boolean)


37
38
39
# File 'lib/generator/helper/activesupport_override.rb', line 37

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


18
19
20
# File 'lib/generator/helper/activesupport_override.rb', line 18

def link_tag(source, relation, type)
  '<link rel="'+relation+'" href="'+source+'" type="'+type+'" />'
end

#meta_tag(type, content) ⇒ Object



10
11
12
# File 'lib/generator/helper/activesupport_override.rb', line 10

def meta_tag(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 meta_tag_http(type, content)
  '<meta http-equiv="'+type+'" content="'+content+'" />'
end

#path_to_css(path) ⇒ Object



22
23
24
25
# File 'lib/generator/helper/activesupport_override.rb', line 22

def path_to_css(path)
  return path if external_path?(path)
  "css/#{path}"
end

#path_to_image(path) ⇒ Object



32
33
34
35
# File 'lib/generator/helper/activesupport_override.rb', line 32

def path_to_image(path)
  return path if external_path? path
  "images/#{path}"
end

#path_to_js(path) ⇒ Object



27
28
29
30
# File 'lib/generator/helper/activesupport_override.rb', line 27

def path_to_js(path)
  return path if external_path? path
  "js/#{path}"
end


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



41
42
43
# File 'lib/generator/helper/activesupport_override.rb', line 41

def url_for(options = '')
 return options
end