Class: Rubimas::Idol::Name

Inherits:
Object
  • Object
show all
Defined in:
lib/rubimas/idol/name.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#akaObject (readonly)

Returns the value of attribute aka.



4
5
6
# File 'lib/rubimas/idol/name.rb', line 4

def aka
  @aka
end

#familyObject (readonly)

Returns the value of attribute family.



4
5
6
# File 'lib/rubimas/idol/name.rb', line 4

def family
  @family
end

#family_kanaObject (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

#givenObject (readonly)

Returns the value of attribute given.



4
5
6
# File 'lib/rubimas/idol/name.rb', line 4

def given
  @given
end

#given_kanaObject (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

#shortenObject (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

#fullObject



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_kanaObject



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_sObject



12
13
14
15
# File 'lib/rubimas/idol/name.rb', line 12

def to_s
  return @aka if @aka
  full
end