Sha256: c03dc4dd810bda518b990aa8861943ef1fbe2c15cfdd543207daa1b332fc66ca

Contents?: true

Size: 680 Bytes

Versions: 12

Compression:

Stored size: 680 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_number?
    self.any_kind_of? Numeric
  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

12 entries across 12 versions & 1 rubygems

Version Path
sugar-high-0.7.3 lib/sugar-high/kind_of.rb
sugar-high-0.7.2 lib/sugar-high/kind_of.rb
sugar-high-0.7.1 lib/sugar-high/kind_of.rb
sugar-high-0.7.0 lib/sugar-high/kind_of.rb
sugar-high-0.6.3 lib/sugar-high/kind_of.rb
sugar-high-0.6.2.1 lib/sugar-high/kind_of.rb
sugar-high-0.6.1 lib/sugar-high/kind_of.rb
sugar-high-0.6.0 lib/sugar-high/kind_of.rb
sugar-high-0.5.5 lib/sugar-high/kind_of.rb
sugar-high-0.5.4 lib/sugar-high/kind_of.rb
sugar-high-0.5.3 lib/sugar-high/kind_of.rb
sugar-high-0.5.1 lib/sugar-high/kind_of.rb