Class: Hakuban::ObjectDescriptor

Inherits:
Object
  • Object
show all
Defined in:
lib/hakuban/hakuban.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(tags, json) ⇒ ObjectDescriptor

Returns a new instance of ObjectDescriptor.



109
110
111
# File 'lib/hakuban/hakuban.rb', line 109

def initialize(tags,json)
	@tags, @json = Set.new(tags), json
end

Instance Attribute Details

#jsonObject (readonly)

Returns the value of attribute json.



107
108
109
# File 'lib/hakuban/hakuban.rb', line 107

def json
  @json
end

#tagsObject (readonly)

Returns the value of attribute tags.



107
108
109
# File 'lib/hakuban/hakuban.rb', line 107

def tags
  @tags
end

Class Method Details

.from_ffi(ffi) ⇒ Object



117
118
119
# File 'lib/hakuban/hakuban.rb', line 117

def self.from_ffi(ffi)
	ObjectDescriptor.new(ffi.tags, ffi.json)
end

Instance Method Details

#==(other) ⇒ Object Also known as: eql?



121
122
123
# File 'lib/hakuban/hakuban.rb', line 121

def ==(other)
	@tags == other.tags and @json == other.json
end

#hashObject



127
128
129
# File 'lib/hakuban/hakuban.rb', line 127

def hash
	[@tags.hash, @json.hash].hash
end

#inspectObject



131
132
133
# File 'lib/hakuban/hakuban.rb', line 131

def inspect
	"#<ObjectDescriptor @tags={%s}, @json=%p>"%[self.tags.map(&:inspect).join(","), self.json]
end

#to_ffiObject



113
114
115
# File 'lib/hakuban/hakuban.rb', line 113

def to_ffi
	FFI::FFIObjectDescriptor.construct(@tags, @json)
end