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
36 37 38 |
# File 'lib/crud_components/like_spec.rb', line 36 def column @column end |
#klass ⇒ Object
Returns the value of attribute klass
36 37 38 |
# File 'lib/crud_components/like_spec.rb', line 36 def klass @klass end |
#path ⇒ Object
Returns the value of attribute path
36 37 38 |
# File 'lib/crud_components/like_spec.rb', line 36 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.
39 40 41 |
# File 'lib/crud_components/like_spec.rb', line 39 def arel_condition(pattern) Arel::Table.new(klass.table_name)[column].matches(pattern, '\\') end |
#join_fragment ⇒ Object
43 44 45 46 47 |
# File 'lib/crud_components/like_spec.rb', line 43 def join_fragment return nil if path.empty? path.reverse.reduce(nil) { |inner, assoc| inner ? { assoc => inner } : assoc } end |