Class: Resume::Skill
- Inherits:
-
Object
- Object
- Resume::Skill
- Defined in:
- lib/resume.rb
Overview
Represents a skill, such as “Java”
Instance Attribute Summary collapse
-
#experience_level ⇒ Object
Returns the value of attribute experience_level.
-
#name ⇒ Object
Returns the value of attribute name.
-
#years_experience ⇒ Object
Returns the value of attribute years_experience.
Class Method Summary collapse
Instance Method Summary collapse
- #<=>(other_skill) ⇒ Object
-
#initialize(name, exp) ⇒ Skill
constructor
A new instance of Skill.
- #to_s ⇒ Object
Constructor Details
#initialize(name, exp) ⇒ Skill
Returns a new instance of Skill.
185 186 187 188 |
# File 'lib/resume.rb', line 185 def initialize(name,exp) @name = name @experience_level = exp end |
Instance Attribute Details
#experience_level ⇒ Object
Returns the value of attribute experience_level.
182 183 184 |
# File 'lib/resume.rb', line 182 def experience_level @experience_level end |
#name ⇒ Object
Returns the value of attribute name.
181 182 183 |
# File 'lib/resume.rb', line 181 def name @name end |
#years_experience ⇒ Object
Returns the value of attribute years_experience.
183 184 185 |
# File 'lib/resume.rb', line 183 def years_experience @years_experience end |
Class Method Details
.scaffold(name = nil) ⇒ Object
207 208 209 210 211 212 213 214 215 216 217 |
# File 'lib/resume.rb', line 207 def Skill.scaffold(name=nil) exp = { 0 => :novice, 1 => :intermdiate, 2 => :expert, } skill = Skill.new(name,exp[rand(3)]) skill.name = "EBCIDIC" if !name skill.years_experience = rand(10) + 1 skill end |
Instance Method Details
#<=>(other_skill) ⇒ Object
190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 |
# File 'lib/resume.rb', line 190 def <=>(other_skill) return 1 if (other_skill == nil) if (other_skill.experience_level == @experience_level) if other_skill.years_experience return @years_experience <=> other_skill.years_experience elsif @years_experience return 1 else return 0 end else return 1 if (@experience_level == :expert) return 1 if (@experience_level == :intermediate && other_skill.experience_level == :novice) return -1; end end |
#to_s ⇒ Object
219 220 221 |
# File 'lib/resume.rb', line 219 def to_s @name end |