Class: CrudComponents::LikeSpec::Entry
- Inherits:
-
Struct
- Object
- Struct
- CrudComponents::LikeSpec::Entry
- Defined in:
- lib/crud_components/like_spec.rb
Instance Attribute Summary collapse
-
#column ⇒ Object
Returns the value of attribute column.
-
#klass ⇒ Object
Returns the value of attribute klass.
-
#path ⇒ Object
Returns the value of attribute path.
Instance Method Summary collapse
-
#arel_condition(pattern) ⇒ Object
escape '' must be explicit: sanitize_sql_like escapes with a backslash, which is not the default LIKE escape char on SQLite.
- #join_fragment ⇒ Object
Instance Attribute Details
#column ⇒ Object
Returns the value of attribute column
37 38 39 |
# File 'lib/crud_components/like_spec.rb', line 37 def column @column end |
#klass ⇒ Object
Returns the value of attribute klass
37 38 39 |
# File 'lib/crud_components/like_spec.rb', line 37 def klass @klass end |
#path ⇒ Object
Returns the value of attribute path
37 38 39 |
# File 'lib/crud_components/like_spec.rb', line 37 def path @path end |
Instance Method Details
#arel_condition(pattern) ⇒ Object
escape '' must be explicit: sanitize_sql_like escapes with a backslash, which is not the default LIKE escape char on SQLite.
40 41 42 |
# File 'lib/crud_components/like_spec.rb', line 40 def arel_condition(pattern) Arel::Table.new(klass.table_name)[column].matches(pattern, '\\') end |
#join_fragment ⇒ Object
44 45 46 47 48 |
# File 'lib/crud_components/like_spec.rb', line 44 def join_fragment return nil if path.empty? path.reverse.reduce(nil) { |inner, assoc| inner ? { assoc => inner } : assoc } end |