Sha256: e0823f6fdadd3256e52a7cce2ad0837520529fe88551c91aa9b35a8559cd6026
Contents?: true
Size: 1.21 KB
Versions: 1
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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
with_filters-0.1.2 | lib/with_filters/models/filter/base_range.rb |