Sha256: abccc5acc3ac12f0c052ccc962719eb51f6c8029b5f2256cca579b9debadf8cb

Contents?: true

Size: 707 Bytes

Versions: 7

Compression:

Stored size: 707 Bytes

Contents

require 'active_support/inflector'

module Artoo
  module Utility
    def constantize(camel_cased_word)
      ActiveSupport::Inflector.constantize(camel_cased_word)
    end

    def classify(underscored)
      ActiveSupport::Inflector.camelize(underscored.to_s.sub(/.*\./, ''))
    end

    def random_string
      (0...8).map{65.+(rand(26)).chr}.join
    end

    def current_instance
      Celluloid::Actor.current
    end

    def current_class
      Celluloid::Actor.current.class
    end
  end
end

# just a bit of syntactic sugar, actually does nothing
# Example:
#  20.seconds => 20
#  1.second => 1
class Integer < Numeric
  def seconds
    return self
  end

  def second
    return self
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
artoo-0.4.0 lib/artoo/utility.rb
artoo-0.3.0 lib/artoo/utility.rb
artoo-0.2.0 lib/artoo/utility.rb
artoo-0.1.3 lib/artoo/utility.rb
artoo-0.1.2 lib/artoo/utility.rb
artoo-0.1.1 lib/artoo/utility.rb
artoo-0.1.0 lib/artoo/utility.rb