Class: Helium::Console::Registry::Element
- Inherits:
-
Object
- Object
- Helium::Console::Registry::Element
show all
- Defined in:
- lib/helium/console/registry.rb
Defined Under Namespace
Classes: LazyStringEvaluator
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(object, **options) ⇒ Element
Returns a new instance of Element.
21
22
23
24
|
# File 'lib/helium/console/registry.rb', line 21
def initialize(object, **options)
@object = object
@options = options
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args) ⇒ Object
47
48
49
50
51
52
|
# 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
|
Instance Attribute Details
#object ⇒ Object
Returns the value of attribute object.
29
30
31
|
# File 'lib/helium/console/registry.rb', line 29
def object
@object
end
|
#options ⇒ Object
Returns the value of attribute options.
29
30
31
|
# File 'lib/helium/console/registry.rb', line 29
def options
@options
end
|
Instance Method Details
#call ⇒ Object
26
27
|
# File 'lib/helium/console/registry.rb', line 26
def call
end
|
35
36
37
|
# 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
|
31
32
33
|
# File 'lib/helium/console/registry.rb', line 31
def format_nested(other_object, **options)
Helium::Console.format(other_object, **nested_opts(options))
end
|
39
40
41
|
# File 'lib/helium/console/registry.rb', line 39
def format_string(string, **options)
Helium::Console.format_string(string, **options)
end
|
#respond_to_missing?(name, private = false) ⇒ Boolean
54
55
56
|
# 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? ⇒ Boolean
43
44
45
|
# File 'lib/helium/console/registry.rb', line 43
def simple?
false
end
|