Class: ActiveInteraction::FilterColumn
- Inherits:
-
Object
- Object
- ActiveInteraction::FilterColumn
- Defined in:
- lib/active_interaction/filter_column.rb
Overview
A minimal implementation of an ‘ActiveRecord::ConnectionAdapters::Column`.
Instance Attribute Summary collapse
- #limit ⇒ nil readonly
- #type ⇒ Symbol readonly
Class Method Summary collapse
-
.intern(type) ⇒ FilterColumn
Find or create the ‘FilterColumn` for a specific type.
Instance Method Summary collapse
-
#initialize(type) ⇒ FilterColumn
constructor
A new instance of FilterColumn.
-
#number? ⇒ Boolean
Returns ‘true` if the column is either of type :integer or :float.
-
#text? ⇒ Boolean
Returns ‘true` if the column is of type :string.
Constructor Details
#initialize(type) ⇒ FilterColumn
Returns a new instance of FilterColumn.
42 43 44 |
# File 'lib/active_interaction/filter_column.rb', line 42 def initialize(type) @type = type end |
Instance Attribute Details
#limit ⇒ nil (readonly)
10 11 12 |
# File 'lib/active_interaction/filter_column.rb', line 10 def limit @limit end |
#type ⇒ Symbol (readonly)
13 14 15 |
# File 'lib/active_interaction/filter_column.rb', line 13 def type @type end |
Class Method Details
.intern(type) ⇒ FilterColumn
Find or create the ‘FilterColumn` for a specific type.
31 32 33 34 |
# File 'lib/active_interaction/filter_column.rb', line 31 def intern(type) @columns ||= {} @columns[type] ||= new(type) end |
Instance Method Details
#number? ⇒ Boolean
Returns ‘true` if the column is either of type :integer or :float.
49 50 51 |
# File 'lib/active_interaction/filter_column.rb', line 49 def number? i[integer float].include?(type) end |
#text? ⇒ Boolean
Returns ‘true` if the column is of type :string.
56 57 58 |
# File 'lib/active_interaction/filter_column.rb', line 56 def text? type == :string end |