lib/tap/support/configuration.rb in bahuvrihi-tap-0.10.0 vs lib/tap/support/configuration.rb in bahuvrihi-tap-0.10.1
- old
+ new
@@ -51,12 +51,12 @@
def initialize(name, default=nil, options={})
@name = name
self.default = default
- self.reader = options.delete(:reader) || name
- self.writer = options.delete(:writer) || "#{name}="
+ self.reader = options.has_key?(:reader) ? options.delete(:reader) : name
+ self.writer = options.has_key?(:writer) ? options.delete(:writer) : "#{name}="
@attributes = options
end
# Sets the default value for self and determines if the
# default is duplicable (ie not nil, true, false, Symbol,
@@ -74,17 +74,19 @@
# value if specified and the default value is duplicable.
def default(duplicate=true)
duplicate && duplicable ? @default.dup : @default
end
- # Sets the reader for self. The reader is symbolized.
+ # Sets the reader for self. The reader is symbolized,
+ # but may also be set to nil.
def reader=(value)
- @reader = value.to_sym
+ @reader = value == nil ? value : value.to_sym
end
- # Sets the writer for self. The writer is symbolized.
+ # Sets the writer for self. The writer is symbolized,
+ # but may also be set to nil.
def writer=(value)
- @writer = value.to_sym
+ @writer = value == nil ? value : value.to_sym
end
def arg_name
attributes[:arg_name] || name.to_s.upcase
end
\ No newline at end of file