Class: ODDB::Html::Util::AnnotatedList
- Inherits:
-
Array
- Object
- Array
- ODDB::Html::Util::AnnotatedList
show all
- Defined in:
- lib/oddb/html/util/annotated_list.rb
Instance Method Summary
collapse
Constructor Details
#initialize(annotations = {}) ⇒ AnnotatedList
Returns a new instance of AnnotatedList.
8
9
10
11
12
13
14
15
16
|
# File 'lib/oddb/html/util/annotated_list.rb', line 8
def initialize(annotations = {})
if(annotations.is_a?(Hash))
super()
@annotations = annotations
else
super
@annotations = {}
end
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(key, *args) ⇒ Object
23
24
25
26
27
28
29
30
31
|
# File 'lib/oddb/html/util/annotated_list.rb', line 23
def method_missing(key, *args)
mname = key.id2name
if(args.size == 1 && /=$/.match(mname))
mname.chop!
@annotations[mname.to_sym] = args.first
else
@annotations[key]
end
end
|
Instance Method Details
#[](*args, &block) ⇒ Object
20
21
22
|
# File 'lib/oddb/html/util/annotated_list.rb', line 20
def [](*args, &block)
_delegate(super(*args, &block))
end
|
#sort_by(*args, &block) ⇒ Object
17
18
19
|
# File 'lib/oddb/html/util/annotated_list.rb', line 17
def sort_by(*args, &block)
_delegate(super(*args, &block))
end
|