Class: Proj::PjObjects
- Inherits:
-
Object
- Object
- Proj::PjObjects
- Defined in:
- lib/proj/pj_objects.rb
Instance Method Summary collapse
- #[](index) ⇒ Object
- #context ⇒ Object
- #count ⇒ Object (also: #size)
-
#initialize(pointer, context) ⇒ PjObjects
constructor
A new instance of PjObjects.
-
#suggested_operation(direction, coord) ⇒ Integer
Returns the index of the operation that would be the most appropriate to transform the specified coordinates.
- #to_ptr ⇒ Object
Constructor Details
#initialize(pointer, context) ⇒ PjObjects
Returns a new instance of PjObjects.
11 12 13 14 15 |
# File 'lib/proj/pj_objects.rb', line 11 def initialize(pointer, context) @pointer = pointer @context = context ObjectSpace.define_finalizer(self, self.class.finalize(@pointer)) end |
Instance Method Details
#[](index) ⇒ Object
30 31 32 33 |
# File 'lib/proj/pj_objects.rb', line 30 def [](index) ptr = Api.proj_list_get(context, self, index) PjObject.create_object(ptr, self.context) end |
#context ⇒ Object
21 22 23 |
# File 'lib/proj/pj_objects.rb', line 21 def context @context || Context.current end |
#count ⇒ Object Also known as: size
25 26 27 |
# File 'lib/proj/pj_objects.rb', line 25 def count Api.proj_list_get_count(self) end |
#suggested_operation(direction, coord) ⇒ Integer
Returns the index of the operation that would be the most appropriate to transform the specified coordinates.
41 42 43 |
# File 'lib/proj/pj_objects.rb', line 41 def suggested_operation(direction, coord) Api.proj_get_suggested_operation(self.context, self, direction, coord) end |
#to_ptr ⇒ Object
17 18 19 |
# File 'lib/proj/pj_objects.rb', line 17 def to_ptr @pointer end |