module TwilioBot::DSLAccessor

Public Instance Methods

dsl_accessor(name) click to toggle source
# File lib/twilio_bot/dsl_accessor.rb, line 6
def dsl_accessor(name)
  ivar = "@#{name}"
  metaclass = class << self; self; end
  metaclass.instance_eval do
    define_method name do |new_value = null|
      instance_variable_set ivar, new_value unless new_value == null
      instance_variable_get ivar
    end
  end
end

Private Instance Methods

null() click to toggle source

make a special object to represent no argument so that auth_token can be set to nil

# File lib/twilio_bot/dsl_accessor.rb, line 21
def null
  @null ||= Object.new
end