class Object

@see Object

Public Instance Methods

empty?() click to toggle source

provides an empty? check for all objects unless an object already has an empty? check

@return [false]

# File lib/fqdn_facts/core_ext.rb, line 25
def empty?
  false
end
present?() click to toggle source

returns true if the object “contains” data (object dependant) @return [Boolean]

# File lib/fqdn_facts/core_ext.rb, line 32
def present?
  !empty?
end
try(method, *args, &block) click to toggle source

attempts to call a public method

@param method <Symbol> the method to attempt to call @param args [Array] optional arguments to pass to the method @param block [Block] optional block to pass to the method

@return the result of the method call, if the method exists, or nil if it doesn't

# File lib/fqdn_facts/core_ext.rb, line 43
def try(method, *args, &block)
  public_send(method, *args, &block)
rescue NoMethodError
  nil
end