Module: SpreeCmCommissioner::OptionValueAttrType
- Extended by:
- ActiveSupport::Concern
- Defined in:
- app/models/concerns/spree_cm_commissioner/option_value_attr_type.rb
Instance Method Summary collapse
- #date ⇒ Object
- #items ⇒ Object
- #latitude ⇒ Object
- #longitude ⇒ Object
- #parse_date(value) ⇒ Object
- #ticket_type? ⇒ Boolean
- #time ⇒ Object
- #update_variants_metadata ⇒ Object
Instance Method Details
#date ⇒ Object
66 67 68 |
# File 'app/models/concerns/spree_cm_commissioner/option_value_attr_type.rb', line 66 def date parse_date(name) end |
#items ⇒ Object
36 37 38 39 40 41 |
# File 'app/models/concerns/spree_cm_commissioner/option_value_attr_type.rb', line 36 def items return nil unless attr_type_array? return nil if name.nil? name.split(',') end |
#latitude ⇒ Object
43 44 45 46 47 48 49 |
# File 'app/models/concerns/spree_cm_commissioner/option_value_attr_type.rb', line 43 def latitude return nil unless attr_type_coordinate? return nil if name.nil? latitude, _longitude = name.split(',').map(&:strip) latitude&.to_f end |
#longitude ⇒ Object
51 52 53 54 55 56 57 |
# File 'app/models/concerns/spree_cm_commissioner/option_value_attr_type.rb', line 51 def longitude return nil unless attr_type_coordinate? return nil if name.nil? _latitude, longitude = name.split(',').map(&:strip) longitude&.to_f end |
#parse_date(value) ⇒ Object
70 71 72 73 74 75 76 |
# File 'app/models/concerns/spree_cm_commissioner/option_value_attr_type.rb', line 70 def parse_date(value) return nil if value.nil? Date.parse(value) rescue Date::Error nil end |
#ticket_type? ⇒ Boolean
32 33 34 |
# File 'app/models/concerns/spree_cm_commissioner/option_value_attr_type.rb', line 32 def ticket_type? option_type.present? && option_type&.ticket_type? end |
#time ⇒ Object
59 60 61 62 63 64 |
# File 'app/models/concerns/spree_cm_commissioner/option_value_attr_type.rb', line 59 def time return nil unless attr_type_time? return nil if name.nil? Time.zone.parse(name) end |
#update_variants_metadata ⇒ Object
78 79 80 |
# File 'app/models/concerns/spree_cm_commissioner/option_value_attr_type.rb', line 78 def SpreeCmCommissioner::OptionValueVariantsPublicMetadataUpdaterJob.perform_later(id) end |