aye_commander 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.adoc +5 -0
- data/lib/aye_commander/resultable.rb +23 -6
- data/lib/aye_commander/version.rb +1 -1
- data/spec/aye_commander/resultable_spec.rb +4 -0
- data/spec/aye_commander/status_spec.rb +4 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: da0a543274b37fae29f538f76fad4d4f623843c9
|
4
|
+
data.tar.gz: cb01c076185caf5b56cd74a40b6946e3cd39e433
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bd388cbf2ad8c23963f21d7ed0201a620c573a0e1e8839087788e5a714c100ad6d23c398f6130b9c79719b1d4f0d57410d0bb0627765f7fb5ba8e44fa5eea00d
|
7
|
+
data.tar.gz: 672f0c73a5ff813f6cf233b2376f8ecaa5502fbd98f2d842e86de76776b445f4027f8610a2727cfc244aacd71691175d71954f893f98eccbc86051b9ad07eedc
|
data/README.adoc
CHANGED
@@ -13,6 +13,7 @@
|
|
13
13
|
:showtitle:
|
14
14
|
:source-highlighter: coderay
|
15
15
|
|
16
|
+
image:https://badge.fury.io/rb/aye_commander.svg["Gem Version", link="https://badge.fury.io/rb/aye_commander"]
|
16
17
|
image:https://travis-ci.org/pyzlnar/aye_commander.svg?branch=master["Build Status", link="https://travis-ci.org/pyzlnar/aye_commander"]
|
17
18
|
image:https://codeclimate.com/github/pyzlnar/aye_commander/badges/gpa.svg["Code Climate", link="https://codeclimate.com/github/pyzlnar/aye_commander"]
|
18
19
|
image:https://codeclimate.com/github/pyzlnar/aye_commander/badges/coverage.svg["Test Coverage", link="https://codeclimate.com/github/pyzlnar/aye_commander/coverage"]
|
@@ -718,3 +719,7 @@ end
|
|
718
719
|
----
|
719
720
|
|
720
721
|
- Write code, have fun!
|
722
|
+
|
723
|
+
== License
|
724
|
+
|
725
|
+
AyeCommander is released under the https://opensource.org/licenses/MIT[MIT License].
|
@@ -42,17 +42,34 @@ module AyeCommander
|
|
42
42
|
# Defines the result class with the necessary modules so it can behave
|
43
43
|
# like a result
|
44
44
|
def define_result_class
|
45
|
-
readers
|
45
|
+
readers = self.readers
|
46
|
+
command_class = self
|
46
47
|
result = Class.new do
|
47
|
-
|
48
|
-
include
|
49
|
-
|
50
|
-
include Ivar::Readable
|
51
|
-
extend Ivar::ClassMethods
|
48
|
+
@command_class = command_class
|
49
|
+
include Result
|
50
|
+
extend Result::ClassMethods
|
52
51
|
attr_reader(*readers)
|
53
52
|
end
|
54
53
|
const_set 'Result', result
|
55
54
|
end
|
56
55
|
end
|
56
|
+
|
57
|
+
# This are the methods included to every result class
|
58
|
+
module Result
|
59
|
+
# These methods are extended to the result class
|
60
|
+
module ClassMethods
|
61
|
+
attr_reader :command_class
|
62
|
+
include Ivar::ClassMethods
|
63
|
+
|
64
|
+
def succeeds
|
65
|
+
command_class.succeeds
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
include Initializable
|
70
|
+
include Inspectable
|
71
|
+
include Status::Readable
|
72
|
+
include Ivar::Readable
|
73
|
+
end
|
57
74
|
end
|
58
75
|
end
|
@@ -44,6 +44,10 @@ describe AyeCommander::Resultable::ClassMethods do
|
|
44
44
|
expect(result_class.object_id).to eq command.result_class.object_id
|
45
45
|
end
|
46
46
|
|
47
|
+
it 'assigns the command to @command_class' do
|
48
|
+
expect(result_class.command_class).to eq command
|
49
|
+
end
|
50
|
+
|
47
51
|
it 'includes the necessary result modules' do
|
48
52
|
expect(result_class).to include AyeCommander::Initializable
|
49
53
|
expect(result_class).to include AyeCommander::Inspectable
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aye_commander
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- pyzlnar
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-08-
|
11
|
+
date: 2016-08-15 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: A gem that helps to write commands in ruby.
|
14
14
|
email: pyzlnar@gmail.com
|