Class: Chicago::Database::Filter Private
- Inherits:
-
Object
- Object
- Chicago::Database::Filter
- Defined in:
- lib/chicago/database/filter.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Direct Known Subclasses
Class Attribute Summary collapse
- .value_parser ⇒ Object private
Instance Attribute Summary collapse
- #column ⇒ Object readonly private
- #value ⇒ Object readonly private
Class Method Summary collapse
- .from_hash(hash) ⇒ Object private
Instance Method Summary collapse
- #filter_dataset(dataset) ⇒ Object private
-
#initialize(column, value) ⇒ Filter
constructor
private
A new instance of Filter.
Constructor Details
#initialize(column, value) ⇒ Filter
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Filter.
39 40 41 42 |
# File 'lib/chicago/database/filter.rb', line 39 def initialize(column, value) @column = column @value = Filter.value_parser.new.parse(column, value) end |
Class Attribute Details
.value_parser ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
10 11 12 |
# File 'lib/chicago/database/filter.rb', line 10 def value_parser @value_parser end |
Instance Attribute Details
#column ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
7 8 9 |
# File 'lib/chicago/database/filter.rb', line 7 def column @column end |
#value ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
7 8 9 |
# File 'lib/chicago/database/filter.rb', line 7 def value @value end |
Class Method Details
.from_hash(hash) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/chicago/database/filter.rb', line 14 def self.from_hash(hash) case hash[:op].to_sym when :eq EqualityFilter.new(hash[:column], hash[:value]) when :lt ComparisonFilter.new(hash[:column], hash[:value], :<) when :lte ComparisonFilter.new(hash[:column], hash[:value], :<=) when :gt ComparisonFilter.new(hash[:column], hash[:value], :>) when :gte ComparisonFilter.new(hash[:column], hash[:value], :>=) when :ne NotFilter.new(EqualityFilter.new(hash[:column], hash[:value])) when :sw StartsWithFilter.new(hash[:column], hash[:value]) when :nsw NotFilter.new(StartsWithFilter.new(hash[:column], hash[:value])) when :con ContainsFilter.new(hash[:column], hash[:value]) when :ncon NotFilter.new(ContainsFilter.new(hash[:column], hash[:value])) end end |
Instance Method Details
#filter_dataset(dataset) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
44 45 46 |
# File 'lib/chicago/database/filter.rb', line 44 def filter_dataset(dataset) column.filter_dataset(dataset, to_sequel) end |