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.
7 8 9 |
# File 'lib/microstation/property_handler.rb', line 7 def initialize(ole) @ole_obj = ole end |
Instance Attribute Details
#ole_obj ⇒ Object (readonly)
Returns the value of attribute ole_obj.
5 6 7 |
# File 'lib/microstation/property_handler.rb', line 5 def ole_obj @ole_obj end |
Instance Method Details
#[](property) ⇒ Object
16 17 18 19 |
# File 'lib/microstation/property_handler.rb', line 16 def [](property) return unless has_property?(property) ole_obj.GetValue end |
#[]=(property, value) ⇒ Object
28 29 30 31 |
# File 'lib/microstation/property_handler.rb', line 28 def []=(property,value) return unless has_property?(property) ole_obj.SetValue(value) end |
#get_property_as_point3d(property) ⇒ Object
21 22 23 24 25 |
# File 'lib/microstation/property_handler.rb', line 21 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
11 12 13 14 |
# File 'lib/microstation/property_handler.rb', line 11 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 |