Class: Refine::Inline::Criteria::Input
- Inherits:
-
Object
- Object
- Refine::Inline::Criteria::Input
- Includes:
- ActiveModel::Model
- Defined in:
- app/models/refine/inline/criteria/input.rb
Constant Summary collapse
- MODIFIERS =
{ ago: "days ago", from_now: "days from now" }.freeze
Instance Attribute Summary collapse
-
#clause ⇒ Object
Returns the value of attribute clause.
-
#count_refinement ⇒ Object
Returns the value of attribute count_refinement.
-
#date1 ⇒ Object
Returns the value of attribute date1.
-
#date2 ⇒ Object
Returns the value of attribute date2.
-
#date_refinement ⇒ Object
Returns the value of attribute date_refinement.
-
#days ⇒ Object
Returns the value of attribute days.
-
#modifier ⇒ Object
Returns the value of attribute modifier.
-
#selected ⇒ Object
Returns the value of attribute selected.
-
#value ⇒ Object
Returns the value of attribute value.
-
#value1 ⇒ Object
Returns the value of attribute value1.
-
#value2 ⇒ Object
Returns the value of attribute value2.
Instance Method Summary collapse
- #attributes ⇒ Object
- #attributes=(attrs = {}) ⇒ Object
- #count_refinement_attributes ⇒ Object
- #count_refinement_attributes=(attrs = {}) ⇒ Object
- #date_refinement_attributes ⇒ Object
- #date_refinement_attributes=(attrs = {}) ⇒ Object
- #strip_values ⇒ Object
Instance Attribute Details
#clause ⇒ Object
Returns the value of attribute clause.
9 10 11 |
# File 'app/models/refine/inline/criteria/input.rb', line 9 def clause @clause end |
#count_refinement ⇒ Object
Returns the value of attribute count_refinement.
9 10 11 |
# File 'app/models/refine/inline/criteria/input.rb', line 9 def count_refinement @count_refinement end |
#date1 ⇒ Object
Returns the value of attribute date1.
9 10 11 |
# File 'app/models/refine/inline/criteria/input.rb', line 9 def date1 @date1 end |
#date2 ⇒ Object
Returns the value of attribute date2.
9 10 11 |
# File 'app/models/refine/inline/criteria/input.rb', line 9 def date2 @date2 end |
#date_refinement ⇒ Object
Returns the value of attribute date_refinement.
9 10 11 |
# File 'app/models/refine/inline/criteria/input.rb', line 9 def date_refinement @date_refinement end |
#days ⇒ Object
Returns the value of attribute days.
9 10 11 |
# File 'app/models/refine/inline/criteria/input.rb', line 9 def days @days end |
#modifier ⇒ Object
Returns the value of attribute modifier.
9 10 11 |
# File 'app/models/refine/inline/criteria/input.rb', line 9 def modifier @modifier end |
#selected ⇒ Object
Returns the value of attribute selected.
9 10 11 |
# File 'app/models/refine/inline/criteria/input.rb', line 9 def selected @selected end |
#value ⇒ Object
Returns the value of attribute value.
9 10 11 |
# File 'app/models/refine/inline/criteria/input.rb', line 9 def value @value end |
#value1 ⇒ Object
Returns the value of attribute value1.
9 10 11 |
# File 'app/models/refine/inline/criteria/input.rb', line 9 def value1 @value1 end |
#value2 ⇒ Object
Returns the value of attribute value2.
9 10 11 |
# File 'app/models/refine/inline/criteria/input.rb', line 9 def value2 @value2 end |
Instance Method Details
#attributes ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'app/models/refine/inline/criteria/input.rb', line 22 def attributes { clause: clause, date1: date1, date2: date2, days: days, modifier: modifier, selected: selected, value: value, value1: value1, value2: value2, count_refinement: count_refinement_attributes.presence, date_refinement: date_refinement_attributes.presence }.compact end |
#attributes=(attrs = {}) ⇒ Object
38 39 40 41 |
# File 'app/models/refine/inline/criteria/input.rb', line 38 def attributes=(attrs = {}) super(attrs) strip_values end |
#count_refinement_attributes ⇒ Object
47 48 49 |
# File 'app/models/refine/inline/criteria/input.rb', line 47 def count_refinement_attributes count_refinement.attributes end |
#count_refinement_attributes=(attrs = {}) ⇒ Object
51 52 53 |
# File 'app/models/refine/inline/criteria/input.rb', line 51 def count_refinement_attributes=(attrs = {}) count_refinement.attributes = attrs.to_h end |
#date_refinement_attributes ⇒ Object
59 60 61 |
# File 'app/models/refine/inline/criteria/input.rb', line 59 def date_refinement_attributes date_refinement.attributes end |
#date_refinement_attributes=(attrs = {}) ⇒ Object
63 64 65 |
# File 'app/models/refine/inline/criteria/input.rb', line 63 def date_refinement_attributes=(attrs = {}) date_refinement.attributes = attrs.to_h end |
#strip_values ⇒ Object
71 72 73 74 75 76 |
# File 'app/models/refine/inline/criteria/input.rb', line 71 def strip_values [:value, :value1, :value2].each do |attr| current_value = send(attr) send("#{attr}=", current_value.strip) if current_value.present? end end |