Class: ComposedValidations::AndStringJoiner
- Inherits:
-
Object
- Object
- ComposedValidations::AndStringJoiner
- Defined in:
- lib/composed_validations/and_string_joiner.rb
Instance Attribute Summary collapse
-
#last_two ⇒ Object
readonly
Returns the value of attribute last_two.
-
#strings ⇒ Object
readonly
Returns the value of attribute strings.
Instance Method Summary collapse
-
#initialize(*strings) ⇒ AndStringJoiner
constructor
A new instance of AndStringJoiner.
- #to_s ⇒ Object
Constructor Details
#initialize(*strings) ⇒ AndStringJoiner
Returns a new instance of AndStringJoiner.
4 5 6 7 |
# File 'lib/composed_validations/and_string_joiner.rb', line 4 def initialize(*strings) @strings = strings @last_two = @strings.pop(2) end |
Instance Attribute Details
#last_two ⇒ Object (readonly)
Returns the value of attribute last_two.
3 4 5 |
# File 'lib/composed_validations/and_string_joiner.rb', line 3 def last_two @last_two end |
#strings ⇒ Object (readonly)
Returns the value of attribute strings.
3 4 5 |
# File 'lib/composed_validations/and_string_joiner.rb', line 3 def strings @strings end |
Instance Method Details
#to_s ⇒ Object
9 10 11 |
# File 'lib/composed_validations/and_string_joiner.rb', line 9 def to_s [first_elements_string, last_two_elements_string].join(", ").gsub(/^, /,'') end |