40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
# File 'lib/capcoauth/config.rb', line 40
def option(name, options = {})
attribute = options[:as] || name
Builder.instance_eval do
define_method name do |*args, &block|
value = block ? block : args.first
@config.instance_variable_set(:"@#{attribute}", value)
end
end
define_method attribute do |*args|
if instance_variable_defined?(:"@#{attribute}")
instance_variable_get(:"@#{attribute}")
else
options[:default]
end
end
public attribute
end
|