class Elasticband::Filter::And

Attributes

filters[RW]
options[RW]

Public Class Methods

new(filters, options = {}) click to toggle source
# File lib/elasticband/filter/and.rb, line 6
def initialize(filters, options = {})
  self.filters = Array.wrap(filters)
  self.options = options
end

Public Instance Methods

to_h() click to toggle source
# File lib/elasticband/filter/and.rb, line 11
def to_h
  { and: filter_hash }
end

Private Instance Methods

filter_hash() click to toggle source
# File lib/elasticband/filter/and.rb, line 17
def filter_hash
  return filters.map(&:to_h) if options.blank?

  { filter: filters.map(&:to_h) }.merge!(options)
end