class
PlaceOS::Model::Trigger::Conditions::Comparison
- PlaceOS::Model::Trigger::Conditions::Comparison
- PlaceOS::Model::SubModel
- ActiveModel::Model
- Reference
- Object
Defined in:
placeos-models/trigger/conditions.crConstant Summary
-
Log =
::Log.for(self)
Constructors
- .from_json(string_or_io : String | IO, trusted : Bool = false) : self
-
.from_json(string_or_io : String | IO, root : String, trusted : Bool = false) : self
Deserializes the given JSON in string_or_io into an instance of
self, assuming the JSON consists of an JSON object with key root, and whose value is the value to deserialize. - .from_trusted_json(string_or_io : String | IO, root : String) : self
-
.from_trusted_json(string_or_io : String | IO) : self
Serialize from a trusted JSON source
-
.from_trusted_yaml(string_or_io : String | IO) : self
Serialize from a trusted YAML source
- .from_yaml(string_or_io : String | IO, trusted : Bool = false) : self
- .new(ctx : YAML::ParseContext, node : YAML::Nodes::Node)
- .new(pull : JSON::PullParser)
- .new(rs : DB::ResultSet)
- .new(left : Bool | Float64 | Int64 | PlaceOS::Model::Trigger::Conditions::Comparison::StatusVariable | String | ActiveModel::Model::None = ::ActiveModel::Model::None.new, operator : PlaceOS::Model::Trigger::Conditions::Comparison::Operator | ActiveModel::Model::None = ::ActiveModel::Model::None.new, right : Bool | Float64 | Int64 | PlaceOS::Model::Trigger::Conditions::Comparison::StatusVariable | String | ActiveModel::Model::None = ::ActiveModel::Model::None.new)
-
.new(params : HTTP::Params | Hash(String, String) | Tuple(String, String))
Initialize PlaceOS::Model::Trigger::Conditions::Comparison from
HTTP::Params.
Class Method Summary
-
.attributes : Array(Symbol)
Returns all attribute keys.
- .from_rs(rs : DB::ResultSet)
Instance Method Summary
- #after_initialize(trusted : Bool)
-
#apply_defaults
Generate code to apply default values
-
#assign_attributes(left : Bool | Float64 | Int64 | PlaceOS::Model::Trigger::Conditions::Comparison::StatusVariable | String | Missing = Missing, operator : PlaceOS::Model::Trigger::Conditions::Comparison::Operator | Missing = Missing, right : Bool | Float64 | Int64 | PlaceOS::Model::Trigger::Conditions::Comparison::StatusVariable | String | Missing = Missing)
Assign to multiple attributes.
-
#assign_attributes(params : HTTP::Params | Hash(String, String) | Tuple(String, String))
Assign to mulitple attributes via
HTTP::Params. -
#assign_attributes(model : PlaceOS::Model::Trigger::Conditions::Comparison)
Assign to multiple attributes from a model object
- #assign_attributes_from_json(json, root : String)
- #assign_attributes_from_json(json)
- #assign_attributes_from_trusted_json(json, root : String)
-
#assign_attributes_from_trusted_json(json)
Assign each field from JSON if field exists in JSON and has changed in model
- #assign_attributes_from_trusted_yaml(yaml)
-
#assign_attributes_from_yaml(yaml)
Uses the YAML parser as JSON is valid YAML
-
#attributes
Returns a
Hashof all attribute values -
#attributes_tuple
Returns a
NamedTupleof all attribute values. -
#changed?
Check if any attributes have changed.
-
#changed_attributes
Returns a
Hashwith all changed attributes. -
#changed_json(io : IO) : Nil
Serialize the set of changed attributes to JSON.
-
#changed_json : String
Serialize the set of changed attributes to JSON.
-
#changed_yaml(io : IO) : Nil
Serialize the set of changed attributes to YAML.
-
#changed_yaml : String
Serialize the set of changed attributes to YAML.
-
#clear_changes_information
Reset changes for all attributes.
-
#left : Bool | Float64 | Int64 | PlaceOS::Model::Trigger::Conditions::Comparison::StatusVariable | String
#leftgetter -
#left=(value : Bool | Float64 | Int64 | PlaceOS::Model::Trigger::Conditions::Comparison::StatusVariable | String)
Setters
#leftsetter -
#left? : Bool | Float64 | Int64 | PlaceOS::Model::Trigger::Conditions::Comparison::StatusVariable | String | Nil
Assign instance variable to correct type
- #left_assigned? : Bool
-
#left_change : Tuple(Bool | Float64 | Int64 | PlaceOS::Model::Trigger::Conditions::Comparison::StatusVariable | String | Nil, Bool | Float64 | Int64 | PlaceOS::Model::Trigger::Conditions::Comparison::StatusVariable | String | Nil) | Nil
Returns a Tuple of the previous and the current value of an instance variable if it has changed
- #left_changed? : Bool
-
#left_default : Value
#left's default value - #left_present? : Bool
- #left_was : Bool | Float64 | Int64 | PlaceOS::Model::Trigger::Conditions::Comparison::StatusVariable | String | Nil
-
#left_will_change! : Nil
Include
#leftin the set of changed attributes, whether it has changed or not. -
#operator : PlaceOS::Model::Trigger::Conditions::Comparison::Operator
#operatorgetter -
#operator=(value : PlaceOS::Model::Trigger::Conditions::Comparison::Operator)
#operatorsetter -
#operator? : PlaceOS::Model::Trigger::Conditions::Comparison::Operator | Nil
Assign instance variable to correct type
- #operator_assigned? : Bool
-
#operator_change : Tuple(PlaceOS::Model::Trigger::Conditions::Comparison::Operator | Nil, PlaceOS::Model::Trigger::Conditions::Comparison::Operator | Nil) | Nil
Returns a Tuple of the previous and the current value of an instance variable if it has changed
- #operator_changed? : Bool
-
#operator_default : Operator
#operator's default value - #operator_present? : Bool
- #operator_was : PlaceOS::Model::Trigger::Conditions::Comparison::Operator | Nil
-
#operator_will_change! : Nil
Include
#operatorin the set of changed attributes, whether it has changed or not. -
#persistent_attributes
Returns a
Hashof all attributes that can be persisted. -
#restore_attributes
Reset each attribute to their previous values and clears all changes.
-
#right : Bool | Float64 | Int64 | PlaceOS::Model::Trigger::Conditions::Comparison::StatusVariable | String
#rightgetter -
#right=(value : Bool | Float64 | Int64 | PlaceOS::Model::Trigger::Conditions::Comparison::StatusVariable | String)
#rightsetter -
#right? : Bool | Float64 | Int64 | PlaceOS::Model::Trigger::Conditions::Comparison::StatusVariable | String | Nil
Assign instance variable to correct type
- #right_assigned? : Bool
-
#right_change : Tuple(Bool | Float64 | Int64 | PlaceOS::Model::Trigger::Conditions::Comparison::StatusVariable | String | Nil, Bool | Float64 | Int64 | PlaceOS::Model::Trigger::Conditions::Comparison::StatusVariable | String | Nil) | Nil
Returns a Tuple of the previous and the current value of an instance variable if it has changed
- #right_changed? : Bool
-
#right_default : Value
#right's default value - #right_present? : Bool
- #right_was : Bool | Float64 | Int64 | PlaceOS::Model::Trigger::Conditions::Comparison::StatusVariable | String | Nil
-
#right_will_change! : Nil
Include
#rightin the set of changed attributes, whether it has changed or not. -
#validate_nilability
Validate that all non-nillable fields have values.
Instance methods inherited from class PlaceOS::Model::SubModel
apply_defaults
apply_defaults,
assign_attributes(params : HTTP::Params | Hash(String, String) | Tuple(String, String))assign_attributes(model : PlaceOS::Model::SubModel)
assign_attributes assign_attributes, attributes attributes, attributes_tuple attributes_tuple, persistent_attributes persistent_attributes, to_reql to_reql
Constructor methods inherited from class PlaceOS::Model::SubModel
new(ctx : YAML::ParseContext, node : YAML::Nodes::Node)new(pull : JSON::PullParser)
new(rs : DB::ResultSet) new
Class methods inherited from class PlaceOS::Model::SubModel
attributes : Array(Symbol)
attributes,
from_rs(rs : DB::ResultSet)
from_rs
Constructor Detail
Deserializes the given JSON in string_or_io into
an instance of self, assuming the JSON consists
of an JSON object with key root, and whose value is
the value to deserialize. Will not deserialise from
fields with mass_assign: false
class User < ActiveModel::Model
attribute name : String
attribute google_id : UUID, mass_assign: false
end
User.from_json(%({"main": {"name": "Jason", "google_id": "f6f70bfb-c882-446d-8758-7ce47db39620"}}), root: "main") # => #<User:0x103131b20 @name="Jason">
Serialize from a trusted JSON source
Serialize from a trusted YAML source
Initialize PlaceOS::Model::Trigger::Conditions::Comparison from HTTP::Params.
Class Method Detail
Instance Method Detail
Assign to multiple attributes.
Assign to mulitple attributes via HTTP::Params.
Assign to multiple attributes from a model object
Assign each field from JSON if field exists in JSON and has changed in model
#left getter
Setters
#left setter
Assign instance variable to correct type
Returns a Tuple of the previous and the current value of an instance variable if it has changed
Include #left in the set of changed attributes, whether it has changed or not.
Assign instance variable to correct type
Returns a Tuple of the previous and the current value of an instance variable if it has changed
Include #operator in the set of changed attributes, whether it has changed or not.
#right getter
#right setter
Assign instance variable to correct type
Returns a Tuple of the previous and the current value of an instance variable if it has changed