lib/sugar-high/array.rb in sugar-high-0.2.2 vs lib/sugar-high/array.rb in sugar-high-0.2.4
- old
+ new
@@ -1,14 +1,13 @@
require 'sugar-high/kind_of'
class Array
def to_symbols option=nil
res = self.flatten
- res = case option
- when :num
- res.map{|a| a.kind_of?(Fixnum) ? "_#{a}" : a}
- else
- res.reject{|a| a.kind_of? Fixnum}
- end
- res.map(&:to_s).map(&:to_sym)
+ res.map!{|a| a.kind_of?(Fixnum) ? "_#{a}" : a} if option == :num
+ res.select_labels.map(&:to_s).map(&:to_sym)
+ end
+
+ def to_strings option=nil
+ self.select_labels.map(&:to_s)
end
end
\ No newline at end of file