corral 0.0.2 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 619742d68fba82f665cb0f3e35ba09acf35e5ceb
4
+ data.tar.gz: 493acbc382bde9159cd33ac345818351bf64ea7a
5
+ SHA512:
6
+ metadata.gz: 79e9d8fd56a693200e2964d7c40ca4429ebea1449f94b471cc21a324b85e39745c32ddcb8b7918a5a18e961a20a9490f032579b1778291a61b46f84a5a433605
7
+ data.tar.gz: 3553a67dffe46df119d4b1bad3569b8c3e6aa17cf8206685ce6327f684400cde0ee7a060ba0816faa5093b32d76324987465dc4e401e46d2e7b4fc5e9672faaf
@@ -1,3 +1,3 @@
1
1
  module Corral
2
- VERSION = "0.0.2"
2
+ VERSION = "0.1.0"
3
3
  end
data/lib/corral.rb CHANGED
@@ -20,32 +20,34 @@ module Corral
20
20
  end
21
21
  end
22
22
 
23
- def corral(&block)
24
- instance_eval(&block)
25
- end
23
+ module Helpers
24
+ def corral(&block)
25
+ instance_eval(&block)
26
+ end
26
27
 
27
- def disabled?(feature, argument = nil)
28
- !enabled?(feature, argument)
29
- end
28
+ def disabled?(feature, argument = nil)
29
+ !enabled?(feature, argument)
30
+ end
30
31
 
31
- def enabled?(feature, argument = nil)
32
- feature = Feature.get(feature)
33
- return false unless feature && (condition = feature.condition)
32
+ def enabled?(feature, argument = nil)
33
+ feature = Feature.get(feature)
34
+ return false unless feature && (condition = feature.condition)
34
35
 
35
- if argument
36
- !condition.call(argument)
37
- else
38
- !condition.call
36
+ if argument
37
+ !condition.call(argument)
38
+ else
39
+ !condition.call
40
+ end
39
41
  end
40
- end
41
42
 
42
- def disable(feature, options = {})
43
- condition = options[:when] || options[:if]
43
+ def disable(feature, options = {})
44
+ condition = options[:when] || options[:if]
44
45
 
45
- if condition && !condition.respond_to?(:call)
46
- raise "'when' or 'if' condition must be a callable object"
47
- end
46
+ if condition && !condition.respond_to?(:call)
47
+ raise "'when' or 'if' condition must be a callable object"
48
+ end
48
49
 
49
- Feature.push(feature, condition)
50
+ Feature.push(feature, condition)
51
+ end
50
52
  end
51
53
  end
data/spec/corral_spec.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Corral do
4
- include Corral
4
+ include Corral::Helpers
5
5
 
6
6
  describe "#corral" do
7
7
  context "when given a block" do
metadata CHANGED
@@ -1,46 +1,41 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: corral
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
5
- prerelease:
4
+ version: 0.1.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Bryan Woods
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-04-12 00:00:00.000000000 Z
11
+ date: 2014-03-10 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: bundler
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ~>
17
+ - - "~>"
20
18
  - !ruby/object:Gem::Version
21
19
  version: '1.3'
22
20
  type: :development
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ~>
24
+ - - "~>"
28
25
  - !ruby/object:Gem::Version
29
26
  version: '1.3'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: rake
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - ">="
36
32
  - !ruby/object:Gem::Version
37
33
  version: '0'
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - ">="
44
39
  - !ruby/object:Gem::Version
45
40
  version: '0'
46
41
  description:
@@ -50,8 +45,8 @@ executables: []
50
45
  extensions: []
51
46
  extra_rdoc_files: []
52
47
  files:
53
- - .gitignore
54
- - .rspec
48
+ - ".gitignore"
49
+ - ".rspec"
55
50
  - Gemfile
56
51
  - LICENSE.txt
57
52
  - README.md
@@ -64,27 +59,26 @@ files:
64
59
  homepage: http://github.com/bryanwoods/corral
65
60
  licenses:
66
61
  - MIT
62
+ metadata: {}
67
63
  post_install_message:
68
64
  rdoc_options: []
69
65
  require_paths:
70
66
  - lib
71
67
  required_ruby_version: !ruby/object:Gem::Requirement
72
- none: false
73
68
  requirements:
74
- - - ! '>='
69
+ - - ">="
75
70
  - !ruby/object:Gem::Version
76
71
  version: '0'
77
72
  required_rubygems_version: !ruby/object:Gem::Requirement
78
- none: false
79
73
  requirements:
80
- - - ! '>='
74
+ - - ">="
81
75
  - !ruby/object:Gem::Version
82
76
  version: '0'
83
77
  requirements: []
84
78
  rubyforge_project:
85
- rubygems_version: 1.8.23
79
+ rubygems_version: 2.2.2
86
80
  signing_key:
87
- specification_version: 3
81
+ specification_version: 4
88
82
  summary: Use Corral to disable certain features in your application.
89
83
  test_files:
90
84
  - spec/corral_spec.rb