Skip to content

Instantly share code, notes, and snippets.

@pashagray
Created August 4, 2017 10:30
Show Gist options
  • Save pashagray/085580972ed892153d3cd40760d987bf to your computer and use it in GitHub Desktop.
Save pashagray/085580972ed892153d3cd40760d987bf to your computer and use it in GitHub Desktop.
class BulkPeriodValidator(array_of_periods)
@array_of_periods = array_of_periods
def valid?
values = value.map { |elem| [elem.endless, elem.trial] }
values.size == values.uniq.size
end
end
period_validator = BulkPeriodValidator.new(your_array_of_periods)
period_validator.valid?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment