acts_as_crazy 0.1.0 → 0.2.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: be02bab17253b7fc84aaf16767b86693b31976ef4306b8dd00a8e18686e2cfc5
4
- data.tar.gz: ba188718754e4b372fab0c445578ab650ff67267a4d958c25641a8c44d0ba221
3
+ metadata.gz: ead82dec8cde4854134f84a89039eeea9b310ce48446036ef3aebaf655ad1dab
4
+ data.tar.gz: ac0243050636ba8d5b331736cd58f17b2a09dfb8cbae3cd8331ea99cbcdea0e3
5
5
  SHA512:
6
- metadata.gz: 3d5ba826adf58f6ebb2482218c16486ec24fa4ba0eae7161f804cd09da4d7363930c65b99099a463504e8d35f6efec11fc38761d1419923ee3f05040dfadaace
7
- data.tar.gz: 33e14af52233e051acef41ae3e59540b4aee61c11c42c5e91a6279a5ea00d1dc0eeeb06a73cfaffeee6f2f3afa00487284b380b5939b0599e9ac0325ea6d6d26
6
+ metadata.gz: a6551643a5c5f202d35169543c4f516f6875c5f2daf3cd447f2ad8f04118e07f0db211a5adebfe6783cbb02057b591d1f9c1c3784c9a8d208cd2322dfb2c2c3c
7
+ data.tar.gz: a92c5a9c8e8dac79780f17653c1cd3fabaab243b98e8ef888caf3d3b64fadcf0083d02fa3d702972c1fa1b6e7a48756096b10ce3a16bdc31853aabc0bd503095
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- acts_as_crazy (0.1.0)
4
+ acts_as_crazy (0.2.0)
5
5
  faker (= 1.9.3)
6
6
 
7
7
  GEM
@@ -0,0 +1,35 @@
1
+ module ActsAsCrazy
2
+ module Crazy
3
+
4
+ class << self
5
+ def included(klass)
6
+ class << klass
7
+ alias_method :__new, :new
8
+ def new(*args)
9
+ e = __new(*args)
10
+
11
+ method_names = e.methods - Object.new.methods
12
+ method_names.each do |method_name|
13
+ e.define_singleton_method :woof do |*args, &block|
14
+ do_something_crazy
15
+ super(*args, &block)
16
+ end
17
+ end
18
+
19
+ e
20
+ end
21
+ end
22
+ end
23
+ end
24
+
25
+ private
26
+
27
+ def do_something_crazy
28
+ raise ActsAsCrazy::CrazyError.new("Sorry, I'm crazy. Did you know that #{Faker::ChuckNorris.fact}") if am_i_crazy?
29
+ end
30
+
31
+ def am_i_crazy?
32
+ (rand*100) < 50
33
+ end
34
+ end
35
+ end
@@ -1,3 +1,3 @@
1
1
  module ActsAsCrazy
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.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.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Israel De La Hoz
@@ -84,6 +84,7 @@ files:
84
84
  - bin/console
85
85
  - bin/setup
86
86
  - lib/acts_as_crazy.rb
87
+ - lib/acts_as_crazy/crazy.rb
87
88
  - lib/acts_as_crazy/version.rb
88
89
  homepage: http://github.com/idelahoz
89
90
  licenses: []