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)


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


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 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



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


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(options = '')
 return options
end