abstractive 0.0.1 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/abstractive.gemspec +1 -1
- data/lib/abstractive.rb +3 -1
- data/lib/abstractive/actor.rb +51 -0
- data/lib/abstractive/additions.rb +11 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d7a9ffa2be2aa934d1d736460d57dfeeffad39f6
|
4
|
+
data.tar.gz: 93a03338e016f5c6ce8f80e23232d537797dcde3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 41be06c635fdff2e5965ea675ff4d05fa4a64d15eb22b3bb69af8829e29d56b56b30b18ac63ae451e34fe1a4ab889db337bae81db58dbe293914bcc4deb271d0
|
7
|
+
data.tar.gz: d8544ad64b5f5444e038340bb85fa06f557e0cfd3bdfaa9c79ae15ff4a1ae73ee3cbc57ee199aac15b08c47f946634dfcac830f7a2bfca88088bbe6d4ed0a163
|
data/abstractive.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |gem|
|
4
4
|
gem.name = "abstractive"
|
5
|
-
gem.version = "0.0.
|
5
|
+
gem.version = "0.0.9"
|
6
6
|
gem.platform = Gem::Platform::RUBY
|
7
7
|
gem.summary = "Base utilities and framework for Abstractive gems."
|
8
8
|
gem.description = "Base utilities and framework for Abstractive gems."
|
data/lib/abstractive.rb
CHANGED
@@ -7,7 +7,7 @@ module Abstractive
|
|
7
7
|
const_get(actor.to_s.capitalize)
|
8
8
|
end
|
9
9
|
end
|
10
|
-
|
10
|
+
|
11
11
|
def shash(data)
|
12
12
|
return unless data.is_a? Hash
|
13
13
|
data.reduce({}) { |cleaned, (k, v)| cleaned.tap { |m| m[k.to_sym] = v } }
|
@@ -18,3 +18,5 @@ module Abstractive
|
|
18
18
|
end
|
19
19
|
end
|
20
20
|
end
|
21
|
+
|
22
|
+
require 'abstractive/additions'
|
@@ -0,0 +1,51 @@
|
|
1
|
+
require 'abstractive'
|
2
|
+
require 'celluloid/current'
|
3
|
+
|
4
|
+
class Abstractive::Actor
|
5
|
+
|
6
|
+
include Celluloid
|
7
|
+
|
8
|
+
def console(message, options={})
|
9
|
+
if @logger
|
10
|
+
@logger.console(message, options.merge(local: true))
|
11
|
+
else
|
12
|
+
plain_output("#{mark}#{message}")
|
13
|
+
end
|
14
|
+
rescue
|
15
|
+
plain_output("#{mark}#{message}")
|
16
|
+
end
|
17
|
+
|
18
|
+
def debug(message)
|
19
|
+
console(message, level: :debug)
|
20
|
+
end
|
21
|
+
|
22
|
+
def exception(ex, *args)
|
23
|
+
return @logger.exception(ex, *args) if @logger
|
24
|
+
plain_output("(#{ex.class}) #{ex.message}: #{args.first}")
|
25
|
+
rescue
|
26
|
+
plain_output("(#{ex.class}) #{ex.message}: #{args.first}")
|
27
|
+
ensure
|
28
|
+
plain_output("(#{ex.class}) #{ex.message}: #{args.first}")
|
29
|
+
end
|
30
|
+
|
31
|
+
def plain_output(message)
|
32
|
+
message = "*, [#{Time.now.strftime('%FT%T.%L')}] #{mark}#{message}"
|
33
|
+
STDERR.puts message
|
34
|
+
STDOUT.puts message
|
35
|
+
end
|
36
|
+
|
37
|
+
def pretty_output object
|
38
|
+
puts JSON.pretty_generate(object)
|
39
|
+
end
|
40
|
+
|
41
|
+
def mark
|
42
|
+
if @mark == true
|
43
|
+
"#{self.class.name} > "
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: abstractive
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- digitalextremist //
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-08-01 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Base utilities and framework for Abstractive gems.
|
14
14
|
email:
|
@@ -23,6 +23,8 @@ files:
|
|
23
23
|
- Rakefile
|
24
24
|
- abstractive.gemspec
|
25
25
|
- lib/abstractive.rb
|
26
|
+
- lib/abstractive/actor.rb
|
27
|
+
- lib/abstractive/additions.rb
|
26
28
|
homepage: https://github.com/abstractive/abstractive
|
27
29
|
licenses:
|
28
30
|
- MIT
|