Sha256: 5f868744cb4a414696064b8c14a19fbf41f3410e8659a832490385dd3c181af7
Contents?: true
Size: 1.21 KB
Versions: 2
Compression:
Stored size: 1.21 KB
Contents
module WithFilters module Filter # @private class BaseStart < Base def initialize(name, namespace, value, options = {}) super @field_name << '[start]' end end # @private class BaseStop < Base def initialize(name, namespace, value, options = {}) super @field_name << '[stop]' end end # @private class BaseRange < Base attr_reader :start, :stop def initialize(name, namespace, value, options = {}) start_attrs = options.delete(:start) || {} stop_attrs = options.delete(:stop) || {} super start_attrs.reverse_merge!(@attrs) start_attrs.reverse_merge!(label: self.label, label_attrs: self.label_attrs, collection: @collection) stop_attrs.reverse_merge!(@attrs) stop_attrs.reverse_merge!(label: self.label, label_attrs: self.label_attrs, collection: @collection) base_class_name = self.class.to_s.match(/^(.*)Range$/).captures.first @start = "#{base_class_name}Start".constantize.new(name, namespace, value[:start], start_attrs) @stop = "#{base_class_name}Stop".constantize.new(name, namespace, value[:stop], stop_attrs) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
with_filters-0.1.1 | lib/with_filters/models/filter/base_range.rb |
with_filters-0.1.0 | lib/with_filters/models/filter/base_range.rb |