Method: Roby::StateModel#initialize

Defined in:
lib/roby/state/state_model.rb

#initialize(super_or_obj = nil, attach_to = nil, attach_name = nil) ⇒ StateModel

Returns a new instance of StateModel.



48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/roby/state/state_model.rb', line 48

def initialize(super_or_obj = nil, attach_to = nil, attach_name = nil)
    super(super_or_obj, attach_to, attach_name)
    global_filter do |name, value|
        if value.respond_to?(:to_state_variable_model)
            value.to_state_variable_model(self, name)
        else
            raise ArgumentError,
                  "cannot set #{value} on #{name} in a state model. "\
                  "Only allowed values are StateVariableModel, and values "\
                  "that respond to #to_state_variable_model"
        end
    end
end