slack 0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ NDkyM2RkNTFjNWM4YmJiYzAxMzFmZGQwNWFjNmVhNTlkYjlhNDViYQ==
5
+ data.tar.gz: !binary |-
6
+ YTZkMjJiYmMyY2IwOWE2MjU2NWJjYzQ4NWU2NWI2NDliMjdmOGM1ZA==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ NDE0NGQ5MTJkODMwYjhhOTYxMzU3YjkxYTVhNWExZWYzNmZlNmZjZmJkZDU5
10
+ MjMxNjhhNzAyMThhN2MwNWRjNTdkOWQ4NDNmMmRiMzcyOTRiMzEwNzBmZmUy
11
+ NmJjNDAwOTExZGM4M2I3YzNlYzIwOTAzZmQxMGM4ODFhYzQ4MzY=
12
+ data.tar.gz: !binary |-
13
+ YjNhNWRmZGY4ODFjZWZiYmMxZWJiMjlhZjM0MzNjNmY5NzFkMzllNWYyNDZk
14
+ YWMyZjdjNjY0NzNiNzcxYTI3ZWY0NDUzMWE3MWEyODFiYjcxZGYyM2U1N2Fj
15
+ YTVkYmIxYTZlNGUzMDc2ODYxYmY1MmQ5Zjc4NWJhNjQzZTVjNzY=
@@ -0,0 +1,16 @@
1
+ Copyright (C) 2013 elliottcable
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
4
+ associated documentation files (the "Software"), to deal in the Software without restriction,
5
+ including without limitation the rights to use, copy, modify, merge, publish, distribute,
6
+ sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
7
+ furnished to do so, subject to the following conditions:
8
+
9
+ The above copyright notice and this permission notice shall be included in all copies or substantial
10
+ portions of the Software.
11
+
12
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
13
+ NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
14
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES
15
+ OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
16
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,17 @@
1
+ Slack
2
+ =====
3
+ Convenience magic for [Speck][].
4
+
5
+ Ideas, feature requests, and bugs can be reported on Speck’s [GitHub][] issue tracker:
6
+
7
+ <http://github.com/elliottcable/Speck/issues>
8
+
9
+ [Speck]: http://github.com/elliottcable/Speck "Speck on GitHub"
10
+ [GitHub]: http://github.com/
11
+
12
+ License
13
+ -------
14
+ This project is licensed very openly for your use, under a variation of the ‘MIT license.’
15
+ Details are available in [LICENSE][].
16
+
17
+ [LICENSE]: <./LICENSE.text>
@@ -0,0 +1,12 @@
1
+ require 'speck'
2
+
3
+ require 'slack/mixins'
4
+
5
+ ##
6
+ # Methods in `Slack` are provided with the purpose of making it simpler (and
7
+ # sexier!) to create `Speck::Check`s.
8
+ module Slack
9
+ VERSION = 0
10
+
11
+
12
+ end
@@ -0,0 +1,15 @@
1
+ require 'slack/mixins/object'
2
+ ::Object.send :include, Slack::Mixins::Object
3
+
4
+ require 'slack/mixins/boolean'
5
+ [::TrueClass, ::FalseClass, ::NilClass]
6
+ .each {|c| c.send :include, Slack::Mixins::Boolean }
7
+
8
+ require 'slack/mixins/proc'
9
+ ::Proc.send :include, Slack::Mixins::Proc
10
+
11
+ require 'slack/mixins/speck'
12
+ ::Speck.send :include, Slack::Mixins::Speck
13
+
14
+ require 'slack/mixins/speck/check'
15
+ ::Speck::Check.send :include, Slack::Mixins::Speck::Check
@@ -0,0 +1,15 @@
1
+ module Slack
2
+ module Mixins
3
+ module Boolean
4
+
5
+ def check
6
+ if block_given?
7
+ super
8
+ else
9
+ ::Speck::Check.new { self.nil? ? false : self }
10
+ end
11
+ end
12
+
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,27 @@
1
+ module Slack
2
+ module Mixins
3
+ module Object
4
+
5
+ ##
6
+ # This method creates a new `Speck::Check` utilizing a passed block.
7
+ #
8
+ # It expects an expectation (returning `true` or `false`) to be passed.
9
+ # The block will be passed the receiver, so you can run comparators on
10
+ # it, or whatever else you like.
11
+ #
12
+ # The intention is that this method be used to quickly check that
13
+ # particular methods return values as expected. For instance, the
14
+ # following would be used to check that MyClass#initialize properly
15
+ # assigns its argument to the `thingie` attribute:
16
+ #
17
+ # MyClass.new(an_object).check {|my| my.thingie == an_object }
18
+ # --
19
+ # TODO: Speck Object#check
20
+ def check &block
21
+ raise LocalJumpError, 'no block given' unless block_given?
22
+ ::Speck::Check.new(self, &block)
23
+ end
24
+
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,25 @@
1
+ module Slack
2
+ module Mixins
3
+ module Proc
4
+
5
+ ##
6
+ # This method creates a new `Speck::Check` initialized to pass if the
7
+ # receiver can be executed without `exception` being raised, or fail if
8
+ # the receiver raises `exception` when raised.
9
+ #
10
+ # The passed exception object will be `rescue`d from within the block,
11
+ # but any other exception raised by the block will not be caught.
12
+ def check_exception exception = Exception
13
+ ::Speck::Check.new(->{self}) do |p|
14
+ begin
15
+ p.call
16
+ false
17
+ rescue exception
18
+ true
19
+ end
20
+ end
21
+ end
22
+
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,7 @@
1
+ module Slack
2
+ module Mixins
3
+ module Speck
4
+
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,26 @@
1
+ module Slack
2
+ module Mixins
3
+ module Speck
4
+ module Check
5
+
6
+ ##
7
+ # This method can “invert” a `Check` object, such that it treats success
8
+ # of the original check block (a truthy return value) as failure (a
9
+ # false return value), and vice versa.
10
+ #
11
+ # This simply wraps the existing block in a new block that calls and
12
+ # inverts the return value.
13
+ def !
14
+ old_expectation, @expectation = @expectation, ->{
15
+ b = old_expectation.arity == 0 ?
16
+ ->{old_expectation.call} :
17
+ ->{old_expectation[@target.call]}
18
+ @status = b.call ? false : true
19
+ }
20
+ return self
21
+ end
22
+
23
+ end
24
+ end
25
+ end
26
+ end
metadata ADDED
@@ -0,0 +1,109 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: slack
3
+ version: !ruby/object:Gem::Version
4
+ version: '0'
5
+ platform: ruby
6
+ authors:
7
+ - elliottcable [http://ell.io/tt]
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-02-28 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: speck
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ! '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '1'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ! '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '1'
27
+ - !ruby/object:Gem::Dependency
28
+ name: spark
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ! '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: yard
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ! '>='
46
+ - !ruby/object:Gem::Version
47
+ version: 0.8.5.2
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: 0.8.5.2
55
+ - !ruby/object:Gem::Dependency
56
+ name: maruku
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: 0.6.1
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ! '>='
67
+ - !ruby/object:Gem::Version
68
+ version: 0.6.1
69
+ description:
70
+ email:
71
+ executables: []
72
+ extensions: []
73
+ extra_rdoc_files: []
74
+ files:
75
+ - lib/slack/mixins/boolean.rb
76
+ - lib/slack/mixins/object.rb
77
+ - lib/slack/mixins/proc.rb
78
+ - lib/slack/mixins/speck/check.rb
79
+ - lib/slack/mixins/speck.rb
80
+ - lib/slack/mixins.rb
81
+ - lib/slack.rb
82
+ - README.markdown
83
+ - LICENSE.text
84
+ homepage: http://github.com/elliottcable/slack
85
+ licenses:
86
+ - MIT
87
+ metadata: {}
88
+ post_install_message:
89
+ rdoc_options: []
90
+ require_paths:
91
+ - lib
92
+ required_ruby_version: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ! '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ required_rubygems_version: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ requirements: []
103
+ rubyforge_project:
104
+ rubygems_version: 2.0.0
105
+ signing_key:
106
+ specification_version: 4
107
+ summary: An extension to Speck, providing convenience methods and monkey-patches.
108
+ test_files: []
109
+ has_rdoc: