Module: PryTheme::Theme::DynamicMethod Private

Included in:
Definition, PryTheme::Theme::Definition::Compound
Defined in:
lib/pry-theme/definition.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Since:

  • 0.2.0

Instance Method Summary collapse

Instance Method Details

#def_dynamic_methods(*dynamic_methods) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 0.2.0



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/pry-theme/definition.rb', line 7

def def_dynamic_methods(*dynamic_methods)
  dynamic_methods.each { |attr|
    define_method(attr) do |*args|
      name = :"@#{ attr }"
      if args.first
        decl =
          Color::Declaration.t(args, instance_variable_get(:@color_model))
        instance_variable_set(name, decl)
      end
      instance_variable_get(name)
    end
  }
end