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.
39 40 41 |
# File 'lib/active_interaction/filter_column.rb', line 39 def initialize(type) @type = type end |
Instance Attribute Details
#limit ⇒ nil (readonly)
7 8 9 |
# File 'lib/active_interaction/filter_column.rb', line 7 def limit @limit end |
#type ⇒ Symbol (readonly)
10 11 12 |
# File 'lib/active_interaction/filter_column.rb', line 10 def type @type end |
Class Method Details
.intern(type) ⇒ FilterColumn
Find or create the ‘FilterColumn` for a specific type.
28 29 30 31 |
# File 'lib/active_interaction/filter_column.rb', line 28 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.
46 47 48 |
# File 'lib/active_interaction/filter_column.rb', line 46 def number? %i[integer float].include?(type) end |
#text? ⇒ Boolean
Returns ‘true` if the column is of type :string.
53 54 55 |
# File 'lib/active_interaction/filter_column.rb', line 53 def text? type == :string end |