Class: Hakuban::ObjectDescriptor
- Inherits:
-
Object
- Object
- Hakuban::ObjectDescriptor
- Defined in:
- lib/hakuban/hakuban.rb
Instance Attribute Summary collapse
-
#json ⇒ Object
readonly
Returns the value of attribute json.
-
#tags ⇒ Object
readonly
Returns the value of attribute tags.
Class Method Summary collapse
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #hash ⇒ Object
-
#initialize(tags, json) ⇒ ObjectDescriptor
constructor
A new instance of ObjectDescriptor.
- #inspect ⇒ Object
- #to_ffi ⇒ Object
Constructor Details
#initialize(tags, json) ⇒ ObjectDescriptor
Returns a new instance of ObjectDescriptor.
161 162 163 164 |
# File 'lib/hakuban/hakuban.rb', line 161 def initialize(,json) @tags = Set.new(.map { |tag| tag.kind_of?(TagDescriptor) ? tag : TagDescriptor.new(tag) }) @json = json end |
Instance Attribute Details
#json ⇒ Object (readonly)
Returns the value of attribute json.
159 160 161 |
# File 'lib/hakuban/hakuban.rb', line 159 def json @json end |
#tags ⇒ Object (readonly)
Returns the value of attribute tags.
159 160 161 |
# File 'lib/hakuban/hakuban.rb', line 159 def @tags end |
Class Method Details
.from_ffi(ffi) ⇒ Object
170 171 172 |
# File 'lib/hakuban/hakuban.rb', line 170 def self.from_ffi(ffi) ObjectDescriptor.new(ffi..map{ |tag| TagDescriptor.new(tag) }, ffi.json) end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
174 175 176 |
# File 'lib/hakuban/hakuban.rb', line 174 def ==(other) @tags == other. and @json == other.json end |
#hash ⇒ Object
180 181 182 |
# File 'lib/hakuban/hakuban.rb', line 180 def hash [@tags.hash, @json.hash].hash end |
#inspect ⇒ Object
184 185 186 |
# File 'lib/hakuban/hakuban.rb', line 184 def inspect "#<ObjectDescriptor @tags={%s}, @json=%p>"%[self..map(&:inspect).join(","), self.json] end |
#to_ffi ⇒ Object
166 167 168 |
# File 'lib/hakuban/hakuban.rb', line 166 def to_ffi FFI::FFIObjectDescriptor.construct(@tags.map(&:json), @json) end |