Class: Bsm::Constrainable::Operation::Between

Inherits:
Base
  • Object
show all
Defined in:
lib/bsm/constrainable/operation/between.rb

Instance Attribute Summary

Attributes inherited from Base

#field, #relation, #value

Instance Method Summary collapse

Methods inherited from Base

#clause, #initialize, #invalid?, kind, #valid?

Constructor Details

This class inherits a constructor from Bsm::Constrainable::Operation::Base

Instance Method Details

#parsedObject



4
5
6
7
8
9
10
11
12
13
14
# File 'lib/bsm/constrainable/operation/between.rb', line 4

def parsed
  result = case value
  when Range
    [value.first, value.last]
  when /^ *(.+?) *\.{2,} *(.+?) *$/
    [$1, $2]
  else
    value
  end
  result.is_a?(Array) && result.size == 2 ? result.map(&:to_s) : nil
end