Class: Object
- Inherits:
- BasicObject
- Defined in:
- lib/fqdn_facts/core_ext.rb
Overview
Instance Method Summary collapse
-
#empty? ⇒ false
provides an empty? check for all objects unless an object already has an empty? check.
-
#present? ⇒ Boolean
returns true if the object “contains” data (object dependant).
-
#try(method, *args, &block) ⇒ Object
attempts to call a public method.
Instance Method Details
#empty? ⇒ false
provides an empty? check for all objects unless an object already has an empty? check
25 26 27 |
# File 'lib/fqdn_facts/core_ext.rb', line 25 def empty? false end |
#present? ⇒ Boolean
returns true if the object “contains” data (object dependant)
32 33 34 |
# File 'lib/fqdn_facts/core_ext.rb', line 32 def present? !empty? end |
#try(method, *args, &block) ⇒ Object
attempts to call a public method
43 44 45 46 47 |
# File 'lib/fqdn_facts/core_ext.rb', line 43 def try(method, *args, &block) public_send(method, *args, &block) rescue NoMethodError nil end |