Module: ESC_POS::Settings

Defined in:
lib/esc-pos/settings.rb

Class Method Summary collapse

Class Method Details

.add_option(name, default_value) ⇒ Object



4
5
6
7
8
9
10
11
12
# File 'lib/esc-pos/settings.rb', line 4

def self.add_option(name, default_value)
  define_singleton_method(name) do
    instance_variable_get("@#{name}") || default_value
  end

  define_singleton_method("#{name}=") do |value|
    instance_variable_set("@#{name}", value)
  end
end