acts_as_crazy 0.3.2 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e0776f710e9ba45f1f90a61e427dedf28988f273c062307ddbd6eed1e94c1c96
4
- data.tar.gz: 879a1e998b2911536a807cd812907f46bc9cd2cc61ebccfecb3bab9eab78dc03
3
+ metadata.gz: ce0de34217da7dbbf4cecd2aa90f0fd24931aa57850148ed8aeea1447c3fead7
4
+ data.tar.gz: d116fe666786d0cc7b4229cf48537304331ac3459d1c155907dfcc3aa6c04d09
5
5
  SHA512:
6
- metadata.gz: 42d092c93c1c1af3463d79ed2868af730049551cbcc9530c88f6591b8adf587e8b271da8d4db8d42cf82b8af05e37f2eed4046744551e57fc80877b6b7f4fcf5
7
- data.tar.gz: 0715f6d9aef359defdc0dc3a3d14bcb87600ed0aecee04d4e8703aacd99eee12fb21ef026f9fd3047ff91b31adbd224b9f99d42a6d60f40c45dea67d9011bd8d
6
+ metadata.gz: b4286f5d77f2b46e4d12ff2894c82e9fe933a2d3fa0424b617bb37be60f655abfb3edbf92302274316328d3a369a7e880737e8ddcb0a4ec6fd08e0d0085b56a3
7
+ data.tar.gz: 16e0c5cc24ef37b8f75639ff069eeb118ad071c8517c560fb59156d0fbf238e253b3634daa6811f694e8c184439c7272ca4ef12fb968ef778e69366a1365f200
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- acts_as_crazy (0.3.2)
4
+ acts_as_crazy (0.4.0)
5
5
  faker (> 1.9)
6
6
 
7
7
  GEM
data/lib/acts_as_crazy.rb CHANGED
@@ -1,14 +1,20 @@
1
1
  require "acts_as_crazy/version"
2
2
  require "acts_as_crazy/crazy"
3
-
3
+ require "acts_as_crazy/configuration"
4
4
 
5
5
  module ActsAsCrazy
6
6
  class << self
7
7
  attr_accessor :configuration
8
+
9
+ def configure
10
+ self.configuration ||= Configuration.new
11
+ yield(configuration)
12
+ end
8
13
  end
9
14
 
10
15
  class Error < StandardError; end
11
16
  class CrazyError < StandardError; end
17
+ class WrongCrazinessError < StandardError; end
12
18
  end
13
19
 
14
20
  Object.class_eval do
@@ -0,0 +1,20 @@
1
+ module ActsAsCrazy
2
+ class Configuration
3
+ attr_reader :craziness_level
4
+
5
+ def initialize
6
+ @craziness_level = 50
7
+ end
8
+
9
+ def craziness_level=(level)
10
+ raise WrongCrazinessError.new("craziness must be between 0 and 100") unless good_craziness_level?(level)
11
+ @craziness_level = level.to_i
12
+ end
13
+
14
+ private
15
+
16
+ def good_craziness_level?(level)
17
+ level >= 0 && level <= 100
18
+ end
19
+ end
20
+ end
@@ -1,3 +1,3 @@
1
1
  module ActsAsCrazy
2
- VERSION = "0.3.2"
2
+ VERSION = "0.4.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acts_as_crazy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Israel De La Hoz