Module: DBusInterface::Class
- Defined in:
- lib/dbus_interface/class.rb
Instance Method Summary collapse
- #default_iface ⇒ Object
-
#instance ⇒ Object
singletons must be given an :object_path.
- #map_dbus(conf) ⇒ Object
- #no_properties! ⇒ Object
- #no_properties? ⇒ Boolean
- #object_path ⇒ Object
- #property(name, type = :string) ⇒ Object
Instance Method Details
#default_iface ⇒ Object
22 23 24 |
# File 'lib/dbus_interface/class.rb', line 22 def default_iface dbus[:default_iface] end |
#instance ⇒ Object
singletons must be given an :object_path
31 32 33 |
# File 'lib/dbus_interface/class.rb', line 31 def instance @instance ||= new end |
#map_dbus(conf) ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 |
# File 'lib/dbus_interface/class.rb', line 2 def map_dbus(conf) @dbus ||= begin # ensure hash raise ArgumentError.new "map_dbus must receive a Hash instead of "\ "#{conf.class}" unless conf.is_a? Hash # ensure :default_iface is set raise ArgumentError.new "map_dbus must specify at least :default_iface"\ unless conf.has_key? :default_iface conf end end |
#no_properties! ⇒ Object
14 15 16 |
# File 'lib/dbus_interface/class.rb', line 14 def no_properties! @no_properties = true end |
#no_properties? ⇒ Boolean
18 19 20 |
# File 'lib/dbus_interface/class.rb', line 18 def no_properties? defined?(@no_properties) && @no_properties ? true : false end |
#object_path ⇒ Object
26 27 28 |
# File 'lib/dbus_interface/class.rb', line 26 def object_path dbus[:object_path] end |
#property(name, type = :string) ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/dbus_interface/class.rb', line 35 def property(name, type = :string) underscored = underscore(name) define_method underscored do self[name] end if type == :boolean define_method "#{underscored}?" do self[name] ? true : false end end end |