Class: Annotations::Annotator
- Inherits:
-
Object
show all
- Defined in:
- lib/spiderfw/utils/annotations.rb
Overview
Instance Method Summary
collapse
Constructor Details
#initialize(owner) ⇒ Annotator
Returns a new instance of Annotator.
68
69
70
71
72
73
74
|
# File 'lib/spiderfw/utils/annotations.rb', line 68
def initialize(owner)
@owner = owner
@annotations = {}
@pending_annotations = []
@m_pending_annotations = []
@pending = @pending_annotations
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args) ⇒ Object
85
86
87
|
# File 'lib/spiderfw/utils/annotations.rb', line 85
def method_missing(name, *args)
@pending << [name, args]
end
|
Instance Method Details
#annotate(method_name, *args) ⇒ Object
89
90
91
|
# File 'lib/spiderfw/utils/annotations.rb', line 89
def annotate(method_name, *args)
@owner.annotations[method_name] = args
end
|
#clear_pending ⇒ Object
81
82
83
|
# File 'lib/spiderfw/utils/annotations.rb', line 81
def clear_pending
@pending_annotations.clear
end
|
98
99
100
101
|
# File 'lib/spiderfw/utils/annotations.rb', line 98
def multiple
@pending = @m_pending_annotations
return self
end
|
76
77
78
79
|
# File 'lib/spiderfw/utils/annotations.rb', line 76
def pending
r = @m_pending_annotations + @pending_annotations
return r
end
|
93
94
95
96
|
# File 'lib/spiderfw/utils/annotations.rb', line 93
def single
@pending = @pending_annotations
return self
end
|