Module: Cv::Content

Defined in:
lib/cv/content.rb

Instance Method Summary collapse

Instance Method Details

#assetsObject



7
8
9
# File 'lib/cv/content.rb', line 7

def assets
  @assets ||= YAML.load_file(File.join(File.dirname(__FILE__), "config", "assets.yml"))
end

#colorsObject



43
44
45
46
47
48
49
50
# File 'lib/cv/content.rb', line 43

def colors
  case content.color
    when "magenta"
      { :dark => "#82003f", :light => "#ec007a" }
    else
      { :dark => "#262C36", :light => "#657792"}
    end
end

#contentObject



3
4
5
# File 'lib/cv/content.rb', line 3

def content
  @content ||= YAML.load_file(Cv::Site.settings.content)
end

#gravatarObject



11
12
13
# File 'lib/cv/content.rb', line 11

def gravatar
  @gravatar ||= "http://www.gravatar.com/avatar/#{Digest::MD5.hexdigest(content.mail)}?s=160"
end

#javascriptsObject



33
34
35
36
37
38
39
40
41
# File 'lib/cv/content.rb', line 33

def javascripts
  if ENV['RACK_ENV'] == 'production'
    '<script src="/assets/all.js"></script>'
  else
    assets.javascripts.all.map { |javascript| 
      "<script src=\"#{javascript.gsub("public","")}\" /></script>"
    }.join
  end
end

#sectionsObject



19
20
21
# File 'lib/cv/content.rb', line 19

def sections
  [['works', 'Work Experience'], ['courses', 'Courses'], ['education', 'Education'], ['languages', 'Languages']]
end

#stylesheetsObject



23
24
25
26
27
28
29
30
31
# File 'lib/cv/content.rb', line 23

def stylesheets
  if ENV['RACK_ENV'] == 'production'
    '<link rel="stylesheet" href="/assets/all.css" />'
  else
    assets.stylesheets.all.map { |stylesheet| 
      "<link rel=\"stylesheet\" href=\"#{stylesheet.gsub("public","")}\" />"
    }.join
  end
end

#to_html(text) ⇒ Object



15
16
17
# File 'lib/cv/content.rb', line 15

def to_html(text)
  RDiscount.new(text).to_html
end