Class: Comply::WhitelistConstantize::MatcherFactory

Inherits:
Object
  • Object
show all
Defined in:
lib/comply/whitelist_constantize.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(obj, options = {}) ⇒ MatcherFactory

Returns a new instance of MatcherFactory.



8
9
10
11
# File 'lib/comply/whitelist_constantize.rb', line 8

def initialize(obj, options = {})
  @obj     = obj
  @options = options
end

Instance Attribute Details

#objObject (readonly)

Returns the value of attribute obj.



7
8
9
# File 'lib/comply/whitelist_constantize.rb', line 7

def obj
  @obj
end

#optionsObject (readonly)

Returns the value of attribute options.



7
8
9
# File 'lib/comply/whitelist_constantize.rb', line 7

def options
  @options
end

Instance Method Details

#to_matcherObject



13
14
15
16
17
18
19
# File 'lib/comply/whitelist_constantize.rb', line 13

def to_matcher
  if obj.is_a?(Module) && options[:include_inheritance]
    procify_module
  else
    obj
  end
end