lib/zenlish/wclasses/irregular_verb_extension.rb in zenlish-0.2.05 vs lib/zenlish/wclasses/irregular_verb_extension.rb in zenlish-0.2.06
- old
+ new
@@ -1,5 +1,7 @@
+# frozen_string_literal: true
+
require_relative 'lexical_verb'
require_relative 'irregular_verb_extension'
module Zenlish
module WClasses
@@ -8,14 +10,14 @@
# Purpose: to inject a number of instance variables in the host
# def extended(host)
def init_extension(host)
host.instance_variable_set(:@forms, [])
end
-
+
# @param theForm [Hash{Symbol => String}]
def forms(theForms)
- valid_symbols = [:past_simple, :past_participle]
+ valid_symbols = %i[past_simple past_participle]
actual_symbols = theForms.keys
actual_symbols.each do |symb|
raise StandardError, "Invalid verb form #{symb}" unless valid_symbols.include?(symb)
end
if actual_symbols.size < valid_symbols.size
@@ -24,16 +26,16 @@
end
@forms = [nil, nil]
@forms[0] = theForms[valid_symbols[0]]
@forms[1] = theForms[valid_symbols[1]]
end
-
+
def past_simple
@forms.first
end
-
+
def past_participle
@forms.last
- end
+ end
end # class
end # module
-end # module
\ No newline at end of file
+end # module