Module: LLT::Helpers::Metrical
- Defined in:
- lib/llt/helpers/metrical.rb
Constant Summary collapse
- QUANTIFIED_CHARS =
{ 'a' => ['ă', 'ā'], 'e' => ['ĕ', 'ē'], 'i' => ['ĭ', 'ī'], 'o' => ['ŏ', 'ō'], 'u' => ['ŭ', 'ū'], 'y' => ['ў', 'ȳ'], }
- QUANTIFIED_CHARS_REGEXP =
/[#{QUANTIFIED_CHARS.values.flatten.join}]/
- QUANTIFIED_CHARS_SUB_MAP =
QUANTIFIED_CHARS.each_with_object({}) do |(norm, quant), h| quant.each { |quantified| h[quantified] = norm } end
Instance Method Summary collapse
- #evaluate_metrical_presence(string) ⇒ Object
- #metrical? ⇒ Boolean
-
#wo_meter(string) ⇒ Object
without meter.
Instance Method Details
#evaluate_metrical_presence(string) ⇒ Object
17 18 19 |
# File 'lib/llt/helpers/metrical.rb', line 17 def evaluate_metrical_presence(string) @metrical = string && string.match(QUANTIFIED_CHARS_REGEXP) end |
#metrical? ⇒ Boolean
21 22 23 |
# File 'lib/llt/helpers/metrical.rb', line 21 def metrical? @metrical end |
#wo_meter(string) ⇒ Object
without meter
26 27 28 |
# File 'lib/llt/helpers/metrical.rb', line 26 def wo_meter(string) string.gsub(QUANTIFIED_CHARS_REGEXP, QUANTIFIED_CHARS_SUB_MAP) end |