Class: ActiveInteraction::Filter::Column
- Inherits:
-
Object
- Object
- ActiveInteraction::Filter::Column
- 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) ⇒ Filter::Column
Find or create the ‘Filter::Column` for a specific type.
Instance Method Summary collapse
-
#initialize(type) ⇒ Column
constructor
A new instance of Column.
-
#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) ⇒ Column
Returns a new instance of Column.
40 41 42 |
# File 'lib/active_interaction/filter/column.rb', line 40 def initialize(type) @type = type end |
Instance Attribute Details
#limit ⇒ nil (readonly)
8 9 10 |
# File 'lib/active_interaction/filter/column.rb', line 8 def limit @limit end |
#type ⇒ Symbol (readonly)
11 12 13 |
# File 'lib/active_interaction/filter/column.rb', line 11 def type @type end |
Class Method Details
.intern(type) ⇒ Filter::Column
Find or create the ‘Filter::Column` for a specific type.
29 30 31 32 |
# File 'lib/active_interaction/filter/column.rb', line 29 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.
47 48 49 |
# File 'lib/active_interaction/filter/column.rb', line 47 def number? %i[integer float].include?(type) end |
#text? ⇒ Boolean
Returns ‘true` if the column is of type :string.
54 55 56 |
# File 'lib/active_interaction/filter/column.rb', line 54 def text? type == :string end |