Sha256: 12268721d625da9c6da8576f28d520482f6fc9893ddfce0b11eecc95a51e676e

Contents?: true

Size: 497 Bytes

Versions: 4

Compression:

Stored size: 497 Bytes

Contents

require 'sugar-high/kind_of'

class Array    
  def to_symbols option=nil
    res = self.flatten
    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.flatten.select_labels.map(&:to_s)
  end  
  
  def none?
    self.flatten.compact.empty?
  end 
  
 def flat_uniq
   self.flatten.compact.uniq
 end
end

class NilClass  
  def flat_uniq  
    []
  end
  
  def none?
    true
  end
end


Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
sugar-high-0.3.3 lib/sugar-high/array.rb
sugar-high-0.3.2 lib/sugar-high/array.rb
sugar-high-0.3.1 lib/sugar-high/array.rb
sugar-high-0.3.0 lib/sugar-high/array.rb