class Dbee::Model::Partitioner
An Partitioner
is a way to explicitly define constraints on a model. For example, say we want to create a data model, but restrict the returned data to a subset based on a 'type' column like ActiveRecord does for Single Table Inheritance. We could use a partition to define this constraint.
Attributes
name[R]
value[R]
Public Class Methods
new(name: '', value: nil)
click to toggle source
# File lib/dbee/model/partitioner.rb, line 21 def initialize(name: '', value: nil) raise ArgumentError, 'name is required' if name.to_s.empty? @name = name.to_s @value = value end
Public Instance Methods
<=>(other)
click to toggle source
# File lib/dbee/model/partitioner.rb, line 28 def <=>(other) "#{name}#{value}" <=> "#{other.name}#{other.value}" end
==(other)
click to toggle source
# File lib/dbee/model/partitioner.rb, line 36 def ==(other) other.instance_of?(self.class) && other.name == name && other.value == value end
Also aliased as: eql?
hash()
click to toggle source
# File lib/dbee/model/partitioner.rb, line 32 def hash "#{name}#{value}".hash end