Class Module
In: lib/sinatra/core_ext/module.rb
Parent: Object

Methods

Public Instance methods

[Source]

    # File lib/sinatra/core_ext/module.rb, line 2
 2:   def attr_with_default(sym, default)
 3:     define_method "#{sym}=" do |obj|
 4:       instance_variable_set("@#{sym}", obj)
 5:     end
 6: 
 7:     define_method sym do 
 8:       instance_variable_get("@#{sym}") || default
 9:     end
10:   end

[Validate]