Module: TpLinkSmartplug::Helpers
Overview
Generic helper methods
Instance Method Summary collapse
-
#debug_message(string) ⇒ Object
Formats a message for output as a debug log.
-
#nil_or_empty?(value) ⇒ Boolean
Tests a variable for nil or empty status.
Instance Method Details
#debug_message(string) ⇒ Object
Formats a message for output as a debug log
9 10 11 12 |
# File 'lib/tp_link_smartplug/helpers.rb', line 9 def (string) caller_method = caller_locations(1..1).first.label $stdout.puts(Time.now.strftime('%Y-%m-%d %H:%M:%S: ').concat("#{caller_method}: ").concat(string)) end |
#nil_or_empty?(value) ⇒ Boolean
Tests a variable for nil or empty status
17 18 19 20 21 |
# File 'lib/tp_link_smartplug/helpers.rb', line 17 def nil_or_empty?(value) return true if value.nil? || (value.respond_to?(:empty?) && value.empty?) false end |