class Helium::Console::Registry::Element

Attributes

object[R]
options[R]

Public Class Methods

new(object, **options) click to toggle source
# File lib/helium/console/registry.rb, line 21
def initialize(object, **options)
  @object = object
  @options = options
end

Public Instance Methods

call() click to toggle source
# File lib/helium/console/registry.rb, line 26
def call
end
format(other_object, **options) click to toggle source
# File lib/helium/console/registry.rb, line 35
def format(other_object, **options)
  Helium::Console.format(other_object, **nested_opts(options, increase_level: false))
end
format_nested(other_object, **options) click to toggle source
# File lib/helium/console/registry.rb, line 31
def format_nested(other_object, **options)
  Helium::Console.format(other_object, **nested_opts(options))
end
format_string(string, **options) click to toggle source
# File lib/helium/console/registry.rb, line 39
def format_string(string, **options)
  Helium::Console.format_string(string, **options)
end
method_missing(name, *args) click to toggle source
Calls superclass method
# File lib/helium/console/registry.rb, line 47
def method_missing(name, *args)
  return @options[name] if @options.key?(name)
  return ColorizedString.new(*args).colorize(name) if ColorizedString.colors.include?(name)

  super
end
respond_to_missing?(name, private = false) click to toggle source
Calls superclass method
# File lib/helium/console/registry.rb, line 54
def respond_to_missing?(name, private = false)
  @options.key?(name) || ColorizedString.colors.include?(name) || super
end
simple?() click to toggle source
# File lib/helium/console/registry.rb, line 43
def simple?
  false
end

Private Instance Methods

length_of(string) click to toggle source
# File lib/helium/console/registry.rb, line 71
def length_of(string)
  ColorizedString.new(string).uncolorize.length
end
nested_objects() click to toggle source
# File lib/helium/console/registry.rb, line 60
def nested_objects
  []
end
nested_opts(new_options, increase_level: true) click to toggle source
# File lib/helium/console/registry.rb, line 64
def nested_opts(new_options, increase_level: true)
  new_options = options.merge(new_options)
  new_options[:level] += 1 if increase_level
  new_options[:ignore_objects] = nested_objects
  new_options
end
yield_lines(&block) click to toggle source
# File lib/helium/console/registry.rb, line 75
def yield_lines(&block)
  LazyStringEvaluator.new(&block)
end