Class: CV
Instance Attribute Summary collapse
-
#file_name ⇒ Object
readonly
Returns the value of attribute file_name.
Class Method Summary collapse
Instance Method Summary collapse
- #data_hash ⇒ Object
- #ga_tracking_id ⇒ Object
-
#initialize(yaml_file) ⇒ CV
constructor
A new instance of CV.
- #link ⇒ Object
- #name ⇒ Object
- #theme ⇒ Object
- #to_s ⇒ Object
- #vitae_config ⇒ Object
Methods included from Vitae::Delegators
Constructor Details
#initialize(yaml_file) ⇒ CV
Returns a new instance of CV.
28 29 30 31 |
# File 'lib/vitae/cv.rb', line 28 def initialize yaml_file @yaml_file = yaml_file @file_name = File.basename(yaml_file, '.yaml') end |
Instance Attribute Details
#file_name ⇒ Object (readonly)
Returns the value of attribute file_name.
6 7 8 |
# File 'lib/vitae/cv.rb', line 6 def file_name @file_name end |
Class Method Details
.all ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/vitae/cv.rb', line 9 def all raise "Vitae::project_root is not set" unless Vitae::project_root cvs = Dir.glob(File.join(Vitae::project_root, "cvs/*.yaml")) cvs.map do |cv| CV.new(cv) end end |
.find(file_name) ⇒ Object
17 18 19 20 21 |
# File 'lib/vitae/cv.rb', line 17 def find file_name all.find do |cv| cv.file_name == file_name end end |
Instance Method Details
#data_hash ⇒ Object
46 47 48 |
# File 'lib/vitae/cv.rb', line 46 def data_hash @data_hash ||= (YAML::load_file(@yaml_file) rescue Hash.new) end |
#ga_tracking_id ⇒ Object
42 43 44 |
# File 'lib/vitae/cv.rb', line 42 def ga_tracking_id vitae_config["ga_tracking_id"] end |
#link ⇒ Object
51 52 53 |
# File 'lib/vitae/cv.rb', line 51 def link "/#{file_name}" end |
#name ⇒ Object
34 35 36 |
# File 'lib/vitae/cv.rb', line 34 def name @name ||= data_hash.delete("name") end |
#theme ⇒ Object
55 56 57 |
# File 'lib/vitae/cv.rb', line 55 def theme "default" end |
#to_s ⇒ Object
59 60 61 |
# File 'lib/vitae/cv.rb', line 59 def to_s name end |
#vitae_config ⇒ Object
38 39 40 |
# File 'lib/vitae/cv.rb', line 38 def vitae_config @vitae_config ||= data_hash.delete("vitae_config") end |