Class: MobileEnhancements::Configuration::Options

Inherits:
Object
  • Object
show all
Defined in:
lib/mobile_enhancements/configuration.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block) ⇒ Object



63
64
65
66
67
68
69
70
71
72
# File 'lib/mobile_enhancements/configuration.rb', line 63

def method_missing(name, *args, &block)
  case args.size
  when 0
    read_attribute(name)
  when 1
    write_attribute(name, args.first)
  else
    super
  end
end

Instance Method Details

#format(*args) ⇒ Object

force format to pass through



51
52
53
# File 'lib/mobile_enhancements/configuration.rb', line 51

def format(*args)
  method_missing("format", *args)
end

#read_attribute(name) ⇒ Object



55
56
57
# File 'lib/mobile_enhancements/configuration.rb', line 55

def read_attribute(name)
  (@properties ||= {})[name]
end

#write_attribute(name, value) ⇒ Object



59
60
61
# File 'lib/mobile_enhancements/configuration.rb', line 59

def write_attribute(name, value)
  (@properties ||= {})[name] = value
end