Class: Influxdb::Arel::Quoter::Repository

Inherits:
Object
  • Object
show all
Defined in:
lib/influxdb/arel/quoter.rb

Instance Method Summary collapse

Constructor Details

#initializeRepository

Returns a new instance of Repository.



9
10
11
# File 'lib/influxdb/arel/quoter.rb', line 9

def initialize
  @types = {}
end

Instance Method Details

#add(type, &block) ⇒ Object



13
14
15
# File 'lib/influxdb/arel/quoter.rb', line 13

def add(type, &block)
  @types[type] = block
end

#quote(value) ⇒ Object



17
18
19
20
# File 'lib/influxdb/arel/quoter.rb', line 17

def quote(value)
  block = @types[value.class]
  block ? block.call(value) : value.inspect
end