Module: Artoo::Utility
- Included in:
- Connection, Device, Robot
- Defined in:
- lib/artoo/utility.rb
Instance Method Summary collapse
- #classify(underscored) ⇒ Object
- #constantize(camel_cased_word) ⇒ Object
- #current_class ⇒ Object
- #current_instance ⇒ Object
- #random_string ⇒ Object
Instance Method Details
#classify(underscored) ⇒ Object
9 10 11 |
# File 'lib/artoo/utility.rb', line 9 def classify(underscored) ActiveSupport::Inflector.camelize(underscored.to_s.sub(/.*\./, '')) end |
#constantize(camel_cased_word) ⇒ Object
5 6 7 |
# File 'lib/artoo/utility.rb', line 5 def constantize(camel_cased_word) ActiveSupport::Inflector.constantize(camel_cased_word) end |
#current_class ⇒ Object
21 22 23 |
# File 'lib/artoo/utility.rb', line 21 def current_class Celluloid::Actor.current.class end |
#current_instance ⇒ Object
17 18 19 |
# File 'lib/artoo/utility.rb', line 17 def current_instance Celluloid::Actor.current end |
#random_string ⇒ Object
13 14 15 |
# File 'lib/artoo/utility.rb', line 13 def random_string (0...8).map{65.+(rand(26)).chr}.join end |