Sha256: 6e547198f718f3bb85f0c44171a8d424895b9545a2c590ab56fc6fcad0540624

Contents?: true

Size: 675 Bytes

Versions: 8

Compression:

Stored size: 675 Bytes

Contents

require "active_support/inflector"
require "sugar-high/enumerable"

class Object
  def kinda_file?
    any_kind_of?(File, Dir)
  end

  def any_kind_of? *kinds
    kinds.all_kinds.each do |kind| 
      return true if self.kind_of? kind        
    end
    false
  end

  def not_any_kind_of? *kinds
    kinds.all_kinds.each do |kind| 
      return false if self.kind_of? kind        
    end
    true
  end

  def kind_of_label?
    self.any_kind_of? String, Symbol          
  end

  def kind_of_symbol?
    self.any_kind_of? Symbols, Symbol          
  end
end
    
class Kinds            
  attr_accessor :kinds
  
  def initialize *kinds
    self.kinds = *kinds
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
sugar-high-0.4.7 lib/sugar-high/kind_of.rb
sugar-high-0.4.6.4 lib/sugar-high/kind_of.rb
sugar-high-0.4.6.3 lib/sugar-high/kind_of.rb
sugar-high-0.4.6.2 lib/sugar-high/kind_of.rb
sugar-high-0.4.6.1 lib/sugar-high/kind_of.rb
sugar-high-0.4.6 lib/sugar-high/kind_of.rb
sugar-high-0.4.5.2 lib/sugar-high/kind_of.rb
sugar-high-0.4.5 lib/sugar-high/kind_of.rb