Class: Objectify::Config::Policies

Inherits:
Object
  • Object
show all
Defined in:
lib/objectify/config/policies.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Policies

Returns a new instance of Policies.



6
7
8
9
# File 'lib/objectify/config/policies.rb', line 6

def initialize(options = {})
  @policies = [*options[:policies]]
  @skip_policies = [*options[:skip_policies]]
end

Instance Attribute Details

#policiesObject (readonly)

Returns the value of attribute policies.



4
5
6
# File 'lib/objectify/config/policies.rb', line 4

def policies
  @policies
end

#skip_policiesObject (readonly)

Returns the value of attribute skip_policies.



4
5
6
# File 'lib/objectify/config/policies.rb', line 4

def skip_policies
  @skip_policies
end

Instance Method Details

#merge(*others) ⇒ Object



11
12
13
14
15
# File 'lib/objectify/config/policies.rb', line 11

def merge(*others)
  others.compact.inject(@policies - @skip_policies) do |total, opts|
    total + [*opts[:policies]] - [*opts[:skip_policies]]
  end
end