bizness 0.8.0 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6599bbc343ef41b029d10213194246af4bf30afd
4
- data.tar.gz: 60a1e05ced98e4e7f0856fb49f5f6bd82f82280e
3
+ metadata.gz: 5763645a9f422b6ffffcd1c7d2479e5e90d954ee
4
+ data.tar.gz: 544d347d96ca56f02295460f2a81b66450b03bfa
5
5
  SHA512:
6
- metadata.gz: 7cb2e525513591afec3878242ef25024a4798dde1522c32e9299cbfae899df7843537998c88ac5aa46ceb118b9f81243cc1aad2cd6bb64be930801c5e5b5a8df
7
- data.tar.gz: 464f51d50728f652d3ce2f04582bf262ed79e90d572f32845d4ecc0720f9e088a108696c8f7b30c98472d127df3155ecedbd7c7fe8b91e77b160fe455769705e
6
+ metadata.gz: 47de010ec86cd7ab359631bff52169b20de0a43418f066947b555b0bc1e726b3913f42390a486d54d9358fc200241e2c643b8d8311ecf80843b99c28dfa96590
7
+ data.tar.gz: 385b68bd06eeaacba49548a8d51caad440b23eda8892f6d7b7aff251d95e58389c72804f3d339dfd326fa089605dd97135be2bf4c3a6ff801be16e6f89b963a8
data/README.md CHANGED
@@ -124,11 +124,11 @@ policy.violations
124
124
  #=> ["String must be alphanumeric", "Characters must be all uppercase"]
125
125
  ```
126
126
 
127
- By including the module, the object gets the `obeyed?` method which does the following when called:
127
+ By including the module, the object gets the `violated?` (and `obeyed?`) method which does the following when called:
128
128
 
129
129
  1. Introspects all private predicate methods (methods that end with a question mark) and executes them
130
130
  2. If the method returns false, it looks for a translation in an I18n YAML file
131
- 3. It composes an 118n key using the policy's class and method name (without the question mark). For example: `policies.mock_policy.violations.all_caps`
131
+ 3. It composes an I18n key using the policy's class and method name (without the question mark). For example: `policies.mock_policy.violations.all_caps`
132
132
  4. It adds the result of the translation to the list of `violations`
133
133
  5. It returns false if any violations are found
134
134
 
@@ -64,6 +64,10 @@ module Bizness::Policy
64
64
  end
65
65
 
66
66
  module ClassMethods
67
+ def policy_enforces(*method_names)
68
+ @__requirements__ = method_names
69
+ end
70
+
67
71
  def violation_message(method)
68
72
  message_key = "#{__violation_key_prefix__}.#{method.to_s.delete("?")}"
69
73
  I18n.t(message_key)
@@ -77,9 +81,7 @@ module Bizness::Policy
77
81
  end
78
82
 
79
83
  def __requirements__
80
- @__requirements__ ||= begin
81
- private_instance_methods(false).select { |m| m.to_s[/\?$/] }
82
- end
84
+ @__requirements__
83
85
  end
84
86
  end
85
87
 
@@ -1,3 +1,3 @@
1
1
  module Bizness
2
- VERSION = "0.8.0"
2
+ VERSION = "0.9.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bizness
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ShippingEasy
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-10-03 00:00:00.000000000 Z
11
+ date: 2015-10-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -154,7 +154,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
154
154
  version: '0'
155
155
  requirements: []
156
156
  rubyforge_project:
157
- rubygems_version: 2.4.8
157
+ rubygems_version: 2.4.6
158
158
  signing_key:
159
159
  specification_version: 4
160
160
  summary: Get your bizness right and organize your business logic into operations.