Class: Sequel::Postgres::PGMultiRange::Creator

Inherits:
Object
  • Object
show all
Defined in:
lib/sequel/extensions/pg_multirange.rb

Overview

Callable object that takes the input string and parses it using Parser.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type, converter = nil) ⇒ Creator

Returns a new instance of Creator.



98
99
100
101
# File 'lib/sequel/extensions/pg_multirange.rb', line 98

def initialize(type, converter=nil)
  @type = type
  @converter = converter
end

Instance Attribute Details

#typeObject (readonly)

The database type to set on the PGMultiRange instances returned.



96
97
98
# File 'lib/sequel/extensions/pg_multirange.rb', line 96

def type
  @type
end

Instance Method Details

#call(string) ⇒ Object

Parse the string using Parser with the appropriate converter, and return a PGMultiRange with the appropriate database type.



106
107
108
# File 'lib/sequel/extensions/pg_multirange.rb', line 106

def call(string)
  PGMultiRange.new(Parser.new(string, @converter).parse, @type)
end