Class: Rubipara::Character
- Inherits:
-
Object
- Object
- Rubipara::Character
- Defined in:
- lib/rubipara/character.rb
Defined Under Namespace
Classes: NotFoundError
Constant Summary collapse
- @@config =
YAML.load_file("#{File.dirname(__FILE__)}/../../config/character.yml")
Instance Attribute Summary collapse
-
#cv ⇒ Object
readonly
Returns the value of attribute cv.
-
#en_name ⇒ Object
readonly
Returns the value of attribute en_name.
-
#fav_phrase ⇒ Object
readonly
Returns the value of attribute fav_phrase.
-
#grade ⇒ Object
readonly
Returns the value of attribute grade.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#team ⇒ Object
readonly
Returns the value of attribute team.
Class Method Summary collapse
-
.all ⇒ Object
return an array of character objects of all characters.
Instance Method Summary collapse
-
#initialize(name) ⇒ Character
constructor
A new instance of Character.
Constructor Details
#initialize(name) ⇒ Character
Returns a new instance of Character.
18 19 20 21 22 23 24 25 26 |
# File 'lib/rubipara/character.rb', line 18 def initialize(name) raise NotFoundError.new('ERROR: No such a character') unless @@config.has_key?(name) @en_name = name # English first name @name = @@config[name]['name'] # Japanese full name @cv = @@config[name]['cv'] @grade = @@config[name]['grade'] @team = @@config[name]['team'] @fav_phrase = @@config[name]['fav_phrase'] end |
Instance Attribute Details
#cv ⇒ Object (readonly)
Returns the value of attribute cv.
5 6 7 |
# File 'lib/rubipara/character.rb', line 5 def cv @cv end |
#en_name ⇒ Object (readonly)
Returns the value of attribute en_name.
5 6 7 |
# File 'lib/rubipara/character.rb', line 5 def en_name @en_name end |
#fav_phrase ⇒ Object (readonly)
Returns the value of attribute fav_phrase.
5 6 7 |
# File 'lib/rubipara/character.rb', line 5 def fav_phrase @fav_phrase end |
#grade ⇒ Object (readonly)
Returns the value of attribute grade.
5 6 7 |
# File 'lib/rubipara/character.rb', line 5 def grade @grade end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/rubipara/character.rb', line 5 def name @name end |
#team ⇒ Object (readonly)
Returns the value of attribute team.
5 6 7 |
# File 'lib/rubipara/character.rb', line 5 def team @team end |