Class: Feature::Operation::In

Inherits:
Object
  • Object
show all
Defined in:
lib/toggles/feature/operation/in.rb

Class Method Summary collapse

Class Method Details

.call(entity, attr_name, expected) ⇒ Object



4
5
6
7
8
9
10
11
12
# File 'lib/toggles/feature/operation/in.rb', line 4

def self.call(entity, attr_name, expected)
  if expected.kind_of? Hash
    expected = expected.reduce([]) do |list, (operation, args)|
      OPERATIONS[operation.to_sym].call(args)
    end
  end

  expected.include? entity.send(attr_name.to_sym)
end