Method: SearchableBy::Column#initialize
- Defined in:
- lib/searchable_by/column.rb
#initialize(attr, type: :string, match: :all, match_phrase: nil, wildcard: nil) ⇒ Column
Returns a new instance of Column.
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/searchable_by/column.rb', line 8 def initialize(attr, type: :string, match: :all, match_phrase: nil, wildcard: nil) @attr = attr @type = type.to_sym @match = match @match_phrase = match_phrase || match @wildcard = wildcard raise ArgumentError, "invalid match option #{@match.inspect}" unless VALID_MATCH_TYPES.include? @match raise ArgumentError, "invalid match_phrase option #{@match_phrase.inspect}" unless VALID_MATCH_TYPES.include? @match_phrase end |