Sha256: 011aa1c9b51d410e5b947e879cb954412a544d496d28bf6e139dc89e79aead00

Contents?: true

Size: 408 Bytes

Versions: 2

Compression:

Stored size: 408 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
end

class NilClass
  def none?
    true
  end
end


Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sugar-high-0.2.12 lib/sugar-high/array.rb
sugar-high-0.2.11 lib/sugar-high/array.rb