Module: CBOR::PP::ObjectMixin
Overview
:nodoc:
Instance Method Summary collapse
- #cbor_add_annotations_from(ann_list) ⇒ Object
- #cbor_annotation_add(v) ⇒ Object
- #cbor_annotation_format ⇒ Object
- #cbor_annotation_replace(v) ⇒ Object
- #cbor_annotations ⇒ Object
- #cbor_clone ⇒ Object
- #cbor_pp(q) ⇒ Object
- #eql?(other) ⇒ Boolean
Instance Method Details
#cbor_add_annotations_from(ann_list) ⇒ Object
91 92 93 94 95 |
# File 'lib/cbor-pp.rb', line 91 def cbor_add_annotations_from(ann_list) _data, anno = ann_list.find{|data, _anno| equal?(data)} f = anno.cbor_annotations f.each {|a| cbor_annotation_add(a)} if f end |
#cbor_annotation_add(v) ⇒ Object
74 75 76 77 78 79 |
# File 'lib/cbor-pp.rb', line 74 def cbor_annotation_add(v) unless frozen? @cbor_annotation ||= [] @cbor_annotation << v unless @cbor_annotation.include? v end end |
#cbor_annotation_format ⇒ Object
86 87 88 89 90 |
# File 'lib/cbor-pp.rb', line 86 def cbor_annotation_format if @cbor_annotation "/" << @cbor_annotation.join(", ") << "/ " end end |
#cbor_annotation_replace(v) ⇒ Object
80 81 82 |
# File 'lib/cbor-pp.rb', line 80 def cbor_annotation_replace(v) @cbor_annotation = [v] end |
#cbor_annotations ⇒ Object
83 84 85 |
# File 'lib/cbor-pp.rb', line 83 def cbor_annotations @cbor_annotation end |
#cbor_clone ⇒ Object
96 97 98 99 100 101 102 |
# File 'lib/cbor-pp.rb', line 96 def cbor_clone if frozen? CBOR::PP::Cloak.new(self) else self end end |
#cbor_pp(q) ⇒ Object
68 69 70 71 72 73 |
# File 'lib/cbor-pp.rb', line 68 def cbor_pp(q) if @cbor_annotation q.text cbor_annotation_format end q.text cbor_diagnostic end |
#eql?(other) ⇒ Boolean
103 104 105 106 107 108 109 |
# File 'lib/cbor-pp.rb', line 103 def eql?(other) if other.respond_to? :__getobj__ eql? other.__getobj__ else super end end |