Class: Deli::Param

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

Defined Under Namespace

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(key, options = {}) ⇒ Param

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

#controllerObject

Returns the value of attribute controller



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

def controller
  @controller
end

#defaultObject

Returns the value of attribute default



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

def default
  @default
end

#exactObject

Returns the value of attribute exact



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

def exact
  @exact
end

#keyObject

Returns the value of attribute key



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

def key
  @key
end

#model_nameObject

Returns the value of attribute model_name



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

def model_name
  @model_name
end

#namespaceObject

Returns the value of attribute namespace



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

def namespace
  @namespace
end

Instance Method Details

#inspectObject



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

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

#parse(value) ⇒ Object



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

def parse(value)
  value
end

#parse_value(value, operators) ⇒ Object



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

#render(value) ⇒ Object



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

def render(value)
  value
end