module Kernel

Public Instance Methods

ex(object, class_filter: nil, attribute_filter: nil, attribute_limit: nil, association_filter: nil, depth: 5)
Alias for: explore
exf(object, file_name = nil, class_filter: nil, attribute_filter: nil, attribute_limit: nil, association_filter: nil, depth: 5)
Alias for: explore_to_file
explore(object, class_filter: nil, attribute_filter: nil, attribute_limit: nil, association_filter: nil, depth: 5) click to toggle source

Explore object and print output to console.

# File lib/active_explorer.rb, line 9
def explore(object, class_filter: nil, attribute_filter: nil, attribute_limit: nil, association_filter: nil, depth: 5)
  if depth <= 0
    puts "Depth must larger than or equal to 1."
    return
  end

  if object.nil?
    puts "Object to be explored is `nil`."
    return
  end

  exploration = ActiveExplorer::Exploration.new object,
                                                depth: depth,
                                                class_filter: class_filter,
                                                attribute_filter: attribute_filter,
                                                attribute_limit: attribute_limit,
                                                association_filter: association_filter
  exploration.to_console
  nil
end
Also aliased as: ex
explore_to_file(object, file_name = nil, class_filter: nil, attribute_filter: nil, attribute_limit: nil, association_filter: nil, depth: 5) click to toggle source

Explore object and print output to image file.

# File lib/active_explorer.rb, line 32
def explore_to_file(object, file_name = nil, class_filter: nil, attribute_filter: nil, attribute_limit: nil, association_filter: nil, depth: 5)
  if depth <= 0
    puts "Depth must larger than or equal to 1."
    return
  end

  if object.nil?
    puts "Object to be explored is `nil`."
    return
  end

  file = file_name.nil? ? "#{object.class.name.downcase}_#{object.id}.png" : file_name

  puts "\nOutput file: #{file}\n"

  exploration = ActiveExplorer::Exploration.new object,
                                                depth: depth,
                                                class_filter: class_filter,
                                                attribute_filter: attribute_filter,
                                                attribute_limit: attribute_limit,
                                                association_filter: association_filter
  exploration.to_image file
  nil
end
Also aliased as: exf