K
Kyle Schmitt
I'll first admit this is a lot cleaner and more succinct than my first
pass of it... but well
Is there a way to make this case and send block clearer and cleaner?
Thanks,
Kyle
def getProperties(type=:textField)
logWarning("Please use a symbol, not a string for :#{type.to_s}")
unless type.is_a?Symbol
converter = case type.to_sym
when :textField,:text_field then "clone"
when :text,:t,:value then "value"
when :html then "html"
else logError("I'm not familiar with :#{type.to_s}, please try
another type.")
end
{:name=>@ie.text_fieldid,/EnvironmentTextEdit/).send(converter),
:start=>@ie.text_fieldid,/StartYearEdit/).send(converter),
:years=>@ie.text_fieldid,/NumberOfYearsEdit/).send(converter)}
end
pass of it... but well
Is there a way to make this case and send block clearer and cleaner?
Thanks,
Kyle
def getProperties(type=:textField)
logWarning("Please use a symbol, not a string for :#{type.to_s}")
unless type.is_a?Symbol
converter = case type.to_sym
when :textField,:text_field then "clone"
when :text,:t,:value then "value"
when :html then "html"
else logError("I'm not familiar with :#{type.to_s}, please try
another type.")
end
{:name=>@ie.text_fieldid,/EnvironmentTextEdit/).send(converter),
:start=>@ie.text_fieldid,/StartYearEdit/).send(converter),
:years=>@ie.text_fieldid,/NumberOfYearsEdit/).send(converter)}
end