Module: Abstractive

Defined in:
lib/abstractive.rb

Defined Under Namespace

Classes: Actor

Class Method Summary collapse

Class Method Details

.[](actor) ⇒ Object



3
4
5
6
7
8
9
# File 'lib/abstractive.rb', line 3

def [](actor)
  if Celluloid[actor]
    Celluloid[actor]
  else
    const_get(actor.to_s.capitalize)
  end
end

.recursive_merge(a, b) ⇒ Object



16
17
18
# File 'lib/abstractive.rb', line 16

def recursive_merge(a, b)
  a.merge(b) {|key, a_item, b_item| recursive_merge(a_item, b_item) }
end

.shash(data) ⇒ Object



11
12
13
14
# File 'lib/abstractive.rb', line 11

def shash(data)
  return unless data.is_a? Hash
  data.reduce({}) { |cleaned, (k, v)| cleaned.tap { |m| m[k.to_sym] = v } }
end