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
FilterColumnfor a specific type.
Instance Method Summary collapse
-
#initialize(type) ⇒ FilterColumn
constructor
A new instance of FilterColumn.
-
#number? ⇒ Boolean
Returns
trueif the column is either of type :integer or :float. -
#text? ⇒ Boolean
Returns
trueif the column is of type :string.
Constructor Details
#initialize(type) ⇒ FilterColumn
Returns a new instance of FilterColumn.
41 42 43 |
# File 'lib/active_interaction/filter_column.rb', line 41 def initialize(type) @type = type end |
Instance Attribute Details
#limit ⇒ nil (readonly)
9 10 11 |
# File 'lib/active_interaction/filter_column.rb', line 9 def limit @limit end |
#type ⇒ Symbol (readonly)
12 13 14 |
# File 'lib/active_interaction/filter_column.rb', line 12 def type @type end |
Class Method Details
.intern(type) ⇒ FilterColumn
Find or create the FilterColumn for a specific type.
30 31 32 33 |
# File 'lib/active_interaction/filter_column.rb', line 30 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.
48 49 50 |
# File 'lib/active_interaction/filter_column.rb', line 48 def number? [:integer, :float].include?(type) end |
#text? ⇒ Boolean
Returns true if the column is of type :string.
55 56 57 |
# File 'lib/active_interaction/filter_column.rb', line 55 def text? type == :string end |