D
dkmd_nielsen
What I want to do is create an attribute, allow it to have a default
value, and have the attribute documented as such (and not as a method)
with rdoc. So, would the proper syntax for accomplishing this
elementary feat be:
# Field (row) delimiter. Default is a comma.
attr_reader fld_delimiter
# :call-seq:
# fld_delimiter
#
# Returns the field (column) delimiter. Default is comma.
def fld_delimiter #:nodoc:
!@fld_delimiter.nil? ? @fld_delimiter : (@fld_delimiter = ',')
end
# :call-seq:
# fld_delimiter(String)
#
# Assign a field (column) delimiter.
def fld_delimiter=(d)
@fld_delimiter = d
end
Thanks for your suggestions.
dvn
value, and have the attribute documented as such (and not as a method)
with rdoc. So, would the proper syntax for accomplishing this
elementary feat be:
# Field (row) delimiter. Default is a comma.
attr_reader fld_delimiter
# :call-seq:
# fld_delimiter
#
# Returns the field (column) delimiter. Default is comma.
def fld_delimiter #:nodoc:
!@fld_delimiter.nil? ? @fld_delimiter : (@fld_delimiter = ',')
end
# :call-seq:
# fld_delimiter(String)
#
# Assign a field (column) delimiter.
def fld_delimiter=(d)
@fld_delimiter = d
end
Thanks for your suggestions.
dvn