Class: Pinyin::TonelessSyllable

Inherits:
Object
  • Object
show all
Defined in:
lib/pinyin/groundwork.rb

Overview

Combination of an initial and a final Not to be confused with a syllable that has the neutral tone

Direct Known Subclasses

Syllable

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(initial, final) ⇒ TonelessSyllable

Returns a new instance of TonelessSyllable.



89
90
91
92
# File 'lib/pinyin/groundwork.rb', line 89

def initialize(initial, final)
  self.initial = initial
  self.final   = final
end

Instance Attribute Details

#finalObject

Returns the value of attribute final.



87
88
89
# File 'lib/pinyin/groundwork.rb', line 87

def final
  @final
end

#initialObject

Returns the value of attribute initial.



87
88
89
# File 'lib/pinyin/groundwork.rb', line 87

def initial
  @initial
end

Class Method Details

.illegal?(i, f) ⇒ Boolean

Returns:

  • (Boolean)


102
103
104
# File 'lib/pinyin/groundwork.rb', line 102

def self.illegal?(i,f)
  ILLEGAL_COMBINATIONS.any? {|in_gr, fin_gr| in_gr.include?(i) && fin_gr.include?(f)}
end

Instance Method Details

#+(tone) ⇒ Object



94
95
96
# File 'lib/pinyin/groundwork.rb', line 94

def +(tone)
  Syllable.new(initial, final, tone)
end

#inspectObject Also known as: to_s



98
99
100
# File 'lib/pinyin/groundwork.rb', line 98

def inspect
  "<#{self.class.name} <initial=#{initial.name}, final=#{final.name}>>"
end