Class: RR::DoubleDefinitions::Strategies::Strategy

Inherits:
Object
  • Object
show all
Includes:
Space::Reader
Defined in:
lib/rr/double_definitions/strategies/strategy.rb

Class Attribute Summary collapse

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Space::Reader

#space

Constructor Details

#initialize(double_definition_creator) ⇒ Strategy

Returns a new instance of Strategy.



31
32
33
# File 'lib/rr/double_definitions/strategies/strategy.rb', line 31

def initialize(double_definition_creator)
  @double_definition_creator = double_definition_creator
end

Class Attribute Details

.domain_nameObject (readonly)

Returns the value of attribute domain_name.



6
7
8
# File 'lib/rr/double_definitions/strategies/strategy.rb', line 6

def domain_name
  @domain_name
end

Instance Attribute Details

#argsObject (readonly)

Returns the value of attribute args.



28
29
30
# File 'lib/rr/double_definitions/strategies/strategy.rb', line 28

def args
  @args
end

#definitionObject (readonly)

Returns the value of attribute definition.



28
29
30
# File 'lib/rr/double_definitions/strategies/strategy.rb', line 28

def definition
  @definition
end

#double_definition_creatorObject (readonly)

Returns the value of attribute double_definition_creator.



28
29
30
# File 'lib/rr/double_definitions/strategies/strategy.rb', line 28

def double_definition_creator
  @double_definition_creator
end

#handlerObject (readonly)

Returns the value of attribute handler.



28
29
30
# File 'lib/rr/double_definitions/strategies/strategy.rb', line 28

def handler
  @handler
end

#method_nameObject (readonly)

Returns the value of attribute method_name.



28
29
30
# File 'lib/rr/double_definitions/strategies/strategy.rb', line 28

def method_name
  @method_name
end

Class Method Details

.register(domain_name, *alias_method_names) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/rr/double_definitions/strategies/strategy.rb', line 7

def register(domain_name, *alias_method_names)
  @domain_name = domain_name
  register_self_at_double_definition_creator(domain_name)
  DoubleDefinitionCreator.class_eval do
    alias_method_names.each do |alias_method_name|
      alias_method alias_method_name, domain_name
    end
  end
  RR::Adapters::RRMethods.register_strategy_class(self, domain_name)
  DoubleDefinition.register_strategy_class(self, domain_name)
  RR::Adapters::RRMethods.class_eval do
    alias_method_names.each do |alias_method_name|
      alias_method alias_method_name, domain_name
    end
  end
end

.register_self_at_double_definition_creatorObject



24
25
# File 'lib/rr/double_definitions/strategies/strategy.rb', line 24

def register_self_at_double_definition_creator
end

Instance Method Details

#call(definition, method_name, args, handler) ⇒ Object



35
36
37
38
# File 'lib/rr/double_definitions/strategies/strategy.rb', line 35

def call(definition, method_name, args, handler)
  @definition, @method_name, @args, @handler = definition, method_name, args, handler
  do_call
end

#nameObject



40
41
42
# File 'lib/rr/double_definitions/strategies/strategy.rb', line 40

def name
  self.class.domain_name
end

#verify_subject(subject) ⇒ Object



44
45
# File 'lib/rr/double_definitions/strategies/strategy.rb', line 44

def verify_subject(subject)
end