class ComposedValidations::OrStringJoiner

Attributes

last_two[R]
strings[R]

Public Class Methods

new(*strings) click to toggle source
# File lib/composed_validations/or_string_joiner.rb, line 4
def initialize(*strings)
  @strings = strings
  @last_two = @strings.pop(2)
end

Public Instance Methods

to_s() click to toggle source
# File lib/composed_validations/or_string_joiner.rb, line 9
def to_s
  [first_elements_string, last_two_elements_string].join(", ").gsub(/^, /,'')
end

Private Instance Methods

first_elements_string() click to toggle source
# File lib/composed_validations/or_string_joiner.rb, line 15
def first_elements_string
  strings.join(", ")
end
last_two_elements_string() click to toggle source
# File lib/composed_validations/or_string_joiner.rb, line 19
def last_two_elements_string
  last_two.join(" or ")
end