mug 0.8.0 → 0.9.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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/mug/self.rb +2 -1
  3. data/test/test-alias.rb +21 -2
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9842c1c25a062fb45ffa2b2a423085d22ad0fe65
4
- data.tar.gz: 5d3175507442566932a3abf26299d2416e02edc6
3
+ metadata.gz: 45e0379a995aa7e948a72772741df51484457902
4
+ data.tar.gz: 8a753bc5fae2c631bbcd06821b0abda4533e062c
5
5
  SHA512:
6
- metadata.gz: 54dbd9e5a2797b30a021e3662ec10658252569aab519d82702e697ed7c48762f141e6e879c8c62de96c72dd269293b39d6f93a7b7884cbc699cc4bbe4f7736c7
7
- data.tar.gz: 0fab0b208c811fa4635174c60b969a23add8e6804506f3f6af5b81183b35effbdfeeafeb7270b943f8c4735b3092518714ab4cb019cc57c90fd7fefc68123e02
6
+ metadata.gz: da6e7d9cfda3a3ce5c80e03fe670aca2a341bf51d040d02087256d5d1aa141cba8a77f7c2c2356ca6affb3a203cbc20e4474ded56bd70b09fb89a0178be9e58d
7
+ data.tar.gz: 2fdec0365017a82dfab05b3389911ce1aedd780bda19c8d0cdf800d0307048eda61fd82571a119086d330159fa462929e0f9067b35c1de60ccd9365544c697c2
@@ -33,10 +33,11 @@ class Object
33
33
  enum_for(:revapply, *args) { args.length + 1 }
34
34
  end
35
35
  end
36
+ alias :cede :revapply
36
37
  end
37
38
 
38
39
  =begin
39
- Copyright (c) 2014, Matthew Kerwin <matthew@kerwin.net.au>
40
+ Copyright (c) 2017, Matthew Kerwin <matthew@kerwin.net.au>
40
41
 
41
42
  Permission to use, copy, modify, and/or distribute this software for any
42
43
  purpose with or without fee is hereby granted, provided that the above
@@ -5,6 +5,9 @@ class ::DummyClass
5
5
  def self.dummy_method
6
6
  :ok
7
7
  end
8
+ def self.clobber_method
9
+ :original
10
+ end
8
11
  end
9
12
 
10
13
  require_relative '../lib/mug/alias'
@@ -17,13 +20,29 @@ class Test_alias < Test::Unit::TestCase
17
20
  ::DummyClass.instance_eval do
18
21
  alias_singleton_method :aliased_method, :dummy_method
19
22
  end
23
+
20
24
  assert_equal( :ok, ::DummyClass.dummy_method )
21
25
  assert_equal( :ok, ::DummyClass.aliased_method )
22
26
  end
23
27
 
28
+ def test_alias_safe
29
+ assert_equal( :original, ::DummyClass.clobber_method )
30
+
31
+ ::DummyClass.instance_eval do
32
+ alias_singleton_method :unclobbered_method, :clobber_method
33
+ def self.clobber_method
34
+ :clobbered
35
+ end
36
+ end
37
+
38
+ assert_equal( :clobbered, ::DummyClass.clobber_method )
39
+ assert_equal( :original, ::DummyClass.unclobbered_method )
40
+ end
41
+
24
42
  def test_alias_return
25
- result = ::DummyClass.instance_eval do
26
- alias_singleton_method :aliased_method2, :dummy_method
43
+ result = nil
44
+ ::DummyClass.instance_eval do
45
+ result = alias_singleton_method :aliased_method2, :dummy_method
27
46
  end
28
47
  assert_equal( ::DummyClass, result )
29
48
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mug
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
  - Matthew Kerwin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-09 00:00:00.000000000 Z
11
+ date: 2017-05-17 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: |
14
14
  == MUG: Matty's Ultimate Gem