Skip to content

Commit

Permalink
Explicitly return false range values from DateTypes
Browse files Browse the repository at this point in the history
  • Loading branch information
kspurgin committed Aug 21, 2024
1 parent 58f11df commit 645c6ce
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/emendate/date_types/error.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def earliest_at_granularity = nil
# @return [NilClass]
def latest_at_granularity = nil

# @return [NilClass]
# @return [FalseClass]
def range? = false

# @return [:invalid_date_type, :unprocessable_date_type,
Expand Down
3 changes: 2 additions & 1 deletion lib/emendate/date_types/year.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@ def validatable? = true
def range?
return false if range_switch == :before &&
Emendate.options.before_date_treatment == :point
return true if partial_indicator || range_switch

true if partial_indicator || range_switch
false
end

private
Expand Down
3 changes: 2 additions & 1 deletion lib/emendate/date_types/year_month.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ def validatable? = true
def range?
return false if range_switch == :before &&
Emendate.options.before_date_treatment == :point
return true if partial_indicator || range_switch

true if partial_indicator || range_switch
false
end

private
Expand Down
3 changes: 2 additions & 1 deletion lib/emendate/date_types/year_month_day.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,9 @@ def literal = "#{year}"\
def range?
return false if range_switch == :before &&
Emendate.options.before_date_treatment == :point
return true if range_switch

true if range_switch
false
end

private
Expand Down

0 comments on commit 645c6ce

Please sign in to comment.