Class: Aspect4r::Model::AdviceMetadata

Inherits:
Object
  • Object
show all
Defined in:
lib/aspect4r/model/advice_metadata.rb

Constant Summary collapse

BEFORE =
new Aspect4r::Model::Advice::BEFORE, nil, :skip_if_false => false
BEFORE_FILTER =
new Aspect4r::Model::Advice::BEFORE, nil, :skip_if_false => true
AFTER =
new Aspect4r::Model::Advice::AFTER, :result_arg => true
AROUND =
new Aspect4r::Model::Advice::AROUND

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(advice_type, default_options = {}, mandatory_options = {}) ⇒ AdviceMetadata

Returns a new instance of AdviceMetadata.



6
7
8
9
10
# File 'lib/aspect4r/model/advice_metadata.rb', line 6

def initialize advice_type, default_options = {}, mandatory_options = {}
  @advice_type       = advice_type
  @default_options   = default_options   || {}
  @mandatory_options = mandatory_options || {}
end

Instance Attribute Details

#advice_typeObject (readonly)

Returns the value of attribute advice_type.



4
5
6
# File 'lib/aspect4r/model/advice_metadata.rb', line 4

def advice_type
  @advice_type
end

#default_optionsObject (readonly)

Returns the value of attribute default_options.



4
5
6
# File 'lib/aspect4r/model/advice_metadata.rb', line 4

def default_options
  @default_options
end

#mandatory_optionsObject (readonly)

Returns the value of attribute mandatory_options.



4
5
6
# File 'lib/aspect4r/model/advice_metadata.rb', line 4

def mandatory_options
  @mandatory_options
end

Instance Method Details

#with_method_prefixObject



12
13
14
15
16
17
18
19
# File 'lib/aspect4r/model/advice_metadata.rb', line 12

def with_method_prefix
  case advice_type
  when Aspect4r::Model::Advice::BEFORE then "a4r_before_"
  when Aspect4r::Model::Advice::AFTER  then "a4r_after_"
  when Aspect4r::Model::Advice::AROUND then "a4r_around_"
  else raise "Aspect4r internal error."
  end
end