Class: Deli::Param

Inherits:
Object
  • Object
show all
Defined in:
lib/deli/param.rb

Direct Known Subclasses

Adapters::ActiveRecord::Param, Adapters::Cassandra::Param, Adapters::Mongoid::Param, Adapters::Neo4j::Param, Adapters::Simple::Param

Defined Under Namespace

Modules: Date, Geo, Limit, Number, Offset, Order, String, Time

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (Param) initialize(key, options = {})

Returns a new instance of Param



150
151
152
153
154
155
156
157
# File 'lib/deli/param.rb', line 150

def initialize(key, options = {})
  self.controller = options[:controller]
  self.key        = key.to_s
  self.model_name = options[:model_name]
  self.namespace  = self.model_name.to_s.pluralize.to_sym if model_name.present?
  self.exact      = options[:exact] || false
  self.default    = options[:default]
end

Instance Attribute Details

- (Object) controller

Returns the value of attribute controller



148
149
150
# File 'lib/deli/param.rb', line 148

def controller
  @controller
end

- (Object) default

Returns the value of attribute default



148
149
150
# File 'lib/deli/param.rb', line 148

def default
  @default
end

- (Object) exact

Returns the value of attribute exact



148
149
150
# File 'lib/deli/param.rb', line 148

def exact
  @exact
end

- (Object) key

Returns the value of attribute key



148
149
150
# File 'lib/deli/param.rb', line 148

def key
  @key
end

- (Object) model_name

Returns the value of attribute model_name



148
149
150
# File 'lib/deli/param.rb', line 148

def model_name
  @model_name
end

- (Object) namespace

Returns the value of attribute namespace



148
149
150
# File 'lib/deli/param.rb', line 148

def namespace
  @namespace
end

Instance Method Details

- (Object) inspect



176
177
178
# File 'lib/deli/param.rb', line 176

def inspect
  "#<#{self.class.name} @key=#{key.inspect} @model_name=#{model_name.inspect}>"
end

- (Object) parse(value)



159
160
161
# File 'lib/deli/param.rb', line 159

def parse(value)
  value
end

- (Object) parse_value(value, operators)



167
168
169
170
171
172
173
174
# File 'lib/deli/param.rb', line 167

def parse_value(value, operators)
  {
    :namespace => namespace,
    :key       => key, 
    :operators => operators,
    :value     => value
  }
end

- (Object) render(value)



163
164
165
# File 'lib/deli/param.rb', line 163

def render(value)
  value
end