class ActsAsRecursiveTree::Options::DepthCondition

Public Instance Methods

!=(other) click to toggle source
# File lib/acts_as_recursive_tree/options/depth_condition.rb, line 11
def !=(other)
  @value     = Values.create(other)
  @operation = false
end
<(other) click to toggle source
# File lib/acts_as_recursive_tree/options/depth_condition.rb, line 16
def <(other)
  @value     = other
  @operation = :lt
end
<=(other) click to toggle source
# File lib/acts_as_recursive_tree/options/depth_condition.rb, line 21
def <=(other)
  @value     = other
  @operation = :lteq
end
==(other) click to toggle source
# File lib/acts_as_recursive_tree/options/depth_condition.rb, line 6
def ==(other)
  @value     = Values.create(other)
  @operation = true
end
>(other) click to toggle source
# File lib/acts_as_recursive_tree/options/depth_condition.rb, line 26
def >(other)
  @value     = other
  @operation = :gt
end
>=(other) click to toggle source
# File lib/acts_as_recursive_tree/options/depth_condition.rb, line 31
def >=(other)
  @value     = other
  @operation = :gteq
end
apply_to(attribute) click to toggle source
# File lib/acts_as_recursive_tree/options/depth_condition.rb, line 36
def apply_to(attribute)
  if @value.is_a?(Values::Base)
    if @operation
      @value.apply_to(attribute)
    else
      @value.apply_negated_to(attribute)
    end
  else
    attribute.send(@operation, @value)
  end
end