Class: Time

Inherits:
Object
  • Object
show all
Defined in:
lib/mqtt/persistence_extensions.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.from_mqtt_string(string) ⇒ Object



7
8
9
10
11
12
# File 'lib/mqtt/persistence_extensions.rb', line 7

def self.from_mqtt_string(string)
	data = JSON.parse(string);
	return nil unless data.is_a? Numeric;

	return self.at(data);
end

Instance Method Details

#to_mqtt_stringObject



3
4
5
# File 'lib/mqtt/persistence_extensions.rb', line 3

def to_mqtt_string
	to_f().to_json()
end