Class: Ansible::Device

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

Overview

root class describing an Ansible Device, i.e. a device controlled at least by one automation protocol supported by Ansible

Arguments:

hashmap

hash consisting of Symbol => AnsibleValue pairs e.g.

:onoff => KNXValue.new("1.001", "1/0/20")

Example:

obj.fire_callback(:onChange, 'GROUPADDR', :arg1, :arg2, :arg3)

Direct Known Subclasses

Switch

Instance Method Summary collapse

Constructor Details

#initialize(hashmap) ⇒ Device

initialize an Ansible Device



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/ansible/ansible_device.rb', line 43

def initialize(hashmap)
    # sanity check: check argument validity
    args_valid = true
    if hashmap.is_a?Hash then
        hashmap.each { |k,v|
            args_valid = args_valid and (k.is_a?Symbol) and (v.is_a?AnsibleValue)
        }
    else
        args_valid = false
    end
    raise "#{self.class}.new requires a hash map of Symbol => AnsibleValue!!!" unless args_valid
    #
    # store hashmap
    @hashmap = hashmap
    # link values
    link()
end