# File lib/mongar/column.rb, line 30 def primary_index self.is_primary_index = true end
class Mongar::Column
Attributes
is_indexed[RW]
is_primary_index[RW]
name[RW]
transformation[RW]
Public Class Methods
new(args = {})
click to toggle source
# File lib/mongar/column.rb, line 5 def initialize(args = {}) self.name = args[:name] self.transformation = nil self.is_indexed = false self.is_primary_index = false end
Public Instance Methods
index()
click to toggle source
# File lib/mongar/column.rb, line 26 def index self.is_indexed = true end
indexed?()
click to toggle source
# File lib/mongar/column.rb, line 34 def indexed? self.is_indexed end
primary_index()
click to toggle source
primary_index?()
click to toggle source
# File lib/mongar/column.rb, line 38 def primary_index? self.is_primary_index end
transform(proc_name = nil, &block)
click to toggle source
# File lib/mongar/column.rb, line 12 def transform(proc_name = nil, &block) self.transformation = lambda do result = self result = instance_exec(result, &block) if block_given? result = result.send(proc_name) if proc_name result end end
transform_this(object)
click to toggle source
# File lib/mongar/column.rb, line 21 def transform_this(object) return object unless transformation && transformation.is_a?(Proc) object.instance_exec(&transformation) end