lib/zakuro/era/japan.rb in zakuro-0.0.2 vs lib/zakuro/era/japan.rb in zakuro-0.0.3
- old
+ new
@@ -87,10 +87,12 @@
end
raise ArgumentError, "invalid date: #{date.format}"
end
end
+ # :reek:TooManyInstanceVariables { max_instance_variables: 5 }
+
#
# Gengou 元号情報
#
class Gengou
# @return [String] 元号名
@@ -267,10 +269,12 @@
#
def self.validate(yaml_hash)
SetParser.new(hash: yaml_hash).validate
end
+ # :reek:TooManyInstanceVariables { max_instance_variables: 5 }
+
#
# GengouParser 元号情報の検証/展開を行う
#
class GengouParser
# @return [Integer] 要素位置
@@ -296,11 +300,11 @@
@start_date = hash['start_date']
@new_year_date = hash['new_year_date']
@start_year = hash['start_year']
end
- # :reek:TooManyStatements { max_statements: 6 }
+ # :reek:TooManyStatements { max_statements: 7 }
#
# 検証する
#
# @return [Array<String>] 不正メッセージ
@@ -602,10 +606,10 @@
def self.lines(date:)
lines = native_lines(date: date)
return lines unless lines[0].invalid?
first = Japan::Gengou.new
- lines[1..-1].each.with_index(1) do |item, index|
+ lines[1..].each.with_index(1) do |item, index|
next if item.invalid?
first = item
lines[index] = Japan::Gengou.new
end