Class: Microstation::PropertyHandler
- Inherits:
-
Object
- Object
- Microstation::PropertyHandler
- Defined in:
- lib/microstation/property_handler.rb
Instance Attribute Summary collapse
-
#ole_obj ⇒ Object
readonly
Returns the value of attribute ole_obj.
Instance Method Summary collapse
- #[](property) ⇒ Object
- #[]=(property, value) ⇒ Object
- #get_property_as_point3d(property) ⇒ Object
- #has_property?(value) ⇒ Boolean
-
#initialize(ole) ⇒ PropertyHandler
constructor
A new instance of PropertyHandler.
- #property_names ⇒ Object
Constructor Details
#initialize(ole) ⇒ PropertyHandler
Returns a new instance of PropertyHandler.
5 6 7 |
# File 'lib/microstation/property_handler.rb', line 5 def initialize(ole) @ole_obj = ole end |
Instance Attribute Details
#ole_obj ⇒ Object (readonly)
Returns the value of attribute ole_obj.
3 4 5 |
# File 'lib/microstation/property_handler.rb', line 3 def ole_obj @ole_obj end |
Instance Method Details
#[](property) ⇒ Object
14 15 16 17 18 |
# File 'lib/microstation/property_handler.rb', line 14 def [](property) return unless has_property?(property) ole_obj.GetValue end |
#[]=(property, value) ⇒ Object
27 28 29 30 31 |
# File 'lib/microstation/property_handler.rb', line 27 def []=(property, value) return unless has_property?(property) ole_obj.SetValue(value) end |
#get_property_as_point3d(property) ⇒ Object
20 21 22 23 24 25 |
# File 'lib/microstation/property_handler.rb', line 20 def get_property_as_point3d(property) return unless has_property?(property) ole_pt = ole_obj.GetValueAsPoint3d Point3d.new(ole_pt) end |
#has_property?(value) ⇒ Boolean
9 10 11 12 |
# File 'lib/microstation/property_handler.rb', line 9 def has_property?(value) prop = ole_obj.SelectByAccessString(value) !!prop end |
#property_names ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/microstation/property_handler.rb', line 33 def property_names names = ole_obj.GetAccessStrings result = [] names.each do |e| if block_given? yield e else result << e end end result unless block_given? end |