Class: Rubimas::Idol::Name
- Inherits:
-
Object
- Object
- Rubimas::Idol::Name
- Defined in:
- lib/rubimas/idol/name.rb
Instance Attribute Summary collapse
-
#aka ⇒ Object
readonly
Returns the value of attribute aka.
-
#family ⇒ Object
readonly
Returns the value of attribute family.
-
#family_kana ⇒ Object
readonly
Returns the value of attribute family_kana.
-
#given ⇒ Object
readonly
Returns the value of attribute given.
-
#given_kana ⇒ Object
readonly
Returns the value of attribute given_kana.
-
#shorten ⇒ Object
readonly
Returns the value of attribute shorten.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #full ⇒ Object
- #full_kana ⇒ Object
-
#initialize(name_object) ⇒ Name
constructor
A new instance of Name.
- #to_s ⇒ Object
Constructor Details
#initialize(name_object) ⇒ Name
Returns a new instance of Name.
6 7 8 9 10 |
# File 'lib/rubimas/idol/name.rb', line 6 def initialize(name_object) name_object.each do |k, v| instance_variable_set("@#{k}", v) end end |
Instance Attribute Details
#aka ⇒ Object (readonly)
Returns the value of attribute aka.
4 5 6 |
# File 'lib/rubimas/idol/name.rb', line 4 def aka @aka end |
#family ⇒ Object (readonly)
Returns the value of attribute family.
4 5 6 |
# File 'lib/rubimas/idol/name.rb', line 4 def family @family end |
#family_kana ⇒ Object (readonly)
Returns the value of attribute family_kana.
4 5 6 |
# File 'lib/rubimas/idol/name.rb', line 4 def family_kana @family_kana end |
#given ⇒ Object (readonly)
Returns the value of attribute given.
4 5 6 |
# File 'lib/rubimas/idol/name.rb', line 4 def given @given end |
#given_kana ⇒ Object (readonly)
Returns the value of attribute given_kana.
4 5 6 |
# File 'lib/rubimas/idol/name.rb', line 4 def given_kana @given_kana end |
#shorten ⇒ Object (readonly)
Returns the value of attribute shorten.
4 5 6 |
# File 'lib/rubimas/idol/name.rb', line 4 def shorten @shorten end |
Instance Method Details
#==(other) ⇒ Object
33 34 35 |
# File 'lib/rubimas/idol/name.rb', line 33 def ==(other) super || [aka, given, full].compact.include?(other) end |
#full ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/rubimas/idol/name.rb', line 17 def full if @family && @given "#{@family}#{@given}" else @aka end end |
#full_kana ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/rubimas/idol/name.rb', line 25 def full_kana if @family_kana && @given_kana "#{@family_kana}#{@given_kana}" else self.full end end |
#to_s ⇒ Object
12 13 14 15 |
# File 'lib/rubimas/idol/name.rb', line 12 def to_s return @aka if @aka full end |