Class: CanTango::Filter::Base
- Inherits:
-
Object
- Object
- CanTango::Filter::Base
- Defined in:
- lib/cantango/filter/base.rb
Instance Attribute Summary collapse
-
#include_list ⇒ Object
readonly
Returns the value of attribute include_list.
-
#item ⇒ Object
readonly
Returns the value of attribute item.
Instance Method Summary collapse
- #excluded? ⇒ Boolean
- #in_include_list? ⇒ Boolean
-
#initialize(item, list = nil) ⇒ Base
constructor
A new instance of Base.
- #not_only? ⇒ Boolean
- #valid? ⇒ Boolean
Constructor Details
#initialize(item, list = nil) ⇒ Base
Returns a new instance of Base.
6 7 8 9 |
# File 'lib/cantango/filter/base.rb', line 6 def initialize item, list = nil @item = item.to_sym @include_list = list.map(&:to_sym) || [] end |
Instance Attribute Details
#include_list ⇒ Object (readonly)
Returns the value of attribute include_list.
4 5 6 |
# File 'lib/cantango/filter/base.rb', line 4 def include_list @include_list end |
#item ⇒ Object (readonly)
Returns the value of attribute item.
4 5 6 |
# File 'lib/cantango/filter/base.rb', line 4 def item @item end |
Instance Method Details
#excluded? ⇒ Boolean
26 27 28 |
# File 'lib/cantango/filter/base.rb', line 26 def excluded? false end |
#in_include_list? ⇒ Boolean
17 18 19 20 |
# File 'lib/cantango/filter/base.rb', line 17 def in_include_list? return false if include_list.blank? include_list.include? item end |
#not_only? ⇒ Boolean
22 23 24 |
# File 'lib/cantango/filter/base.rb', line 22 def not_only? false end |
#valid? ⇒ Boolean
11 12 13 14 15 |
# File 'lib/cantango/filter/base.rb', line 11 def valid? return false if !in_include_list? return false if not_only? !excluded? end |