Class: Meta2::Resolver

Inherits:
Object
  • Object
show all
Defined in:
lib/meta2/resolver.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#contextObject (readonly)

Returns the value of attribute context.



3
4
5
# File 'lib/meta2/resolver.rb', line 3

def context
  @context
end

#optionsObject (readonly)

Returns the value of attribute options.



3
4
5
# File 'lib/meta2/resolver.rb', line 3

def options
  @options
end

#strategyObject (readonly)

Returns the value of attribute strategy.



3
4
5
# File 'lib/meta2/resolver.rb', line 3

def strategy
  @strategy
end

Instance Method Details

#detectObject



9
10
11
12
13
14
15
# File 'lib/meta2/resolver.rb', line 9

def detect
  Meta2.debug "strategy: #{strategy}"
  strategy_class_name = "Meta2::Strategies::#{@strategy.to_s.camelize}"

  strategy = strategy_class_name.constantize.new @options
  strategy.detect
end

#setup(strategy, context, options) ⇒ Object



5
6
7
# File 'lib/meta2/resolver.rb', line 5

def setup(strategy, context, options)
  @strategy, @context, @options = strategy, context, options
end