simple_delegate 0.0.1 → 0.0.2

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: 8c4fd652c4eb32b50e18af6623d8b31ebb699d07
4
- data.tar.gz: 8e12309e549fc21d4233fe94a16ddc2d27d0bcc4
3
+ metadata.gz: 844e094ec35e8893844bbf432ed8c06dbbf1de68
4
+ data.tar.gz: 929a9f5962f497c97fe86a2f3010f33243cb6c62
5
5
  SHA512:
6
- metadata.gz: 74185602036fc2be0b7741cb05593dc2a336fdf582f60a13ed3abe60351588587f3a8c1273c6d0cc517efb7b2ae8152773fd017536f5b71893407ab9b24d2785
7
- data.tar.gz: ba69fd03a8e74b6a43344e7c7a911b1fbc64cf05cda6897ad50d32f57cc0d0653bf55d9b564ac7683f2ff497ca510119bbf2468ed8e61b9918dd3a4b14c07d7e
6
+ metadata.gz: d955547a8126eb7e1e4753fb7dc30477b3f57658d2f2a4029d30233334b073b403b193c5a8f47a2a8bd1476ec1a9cd18a4201b053fe78f194df65d44c6fbff97
7
+ data.tar.gz: a4d2d0b0b34fd6bb37ecdbbb2beff2c82cf09f034130e176527c9bd3d846bcf02a1e4bae1a16b6cd1299e05049ad430167faf13bd927e4156882c5c723920466
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.0.2
@@ -9,15 +9,16 @@ module SimpleDelegate
9
9
 
10
10
  args.each do |method|
11
11
  define_method(method) do |*method_args, &method_blk|
12
- if opts[:to]
13
- object = instance_variable_get("@#{opts.fetch(:to)}")
14
- elsif opts[:to_method]
15
- object = __send__(opts.fetch(:to_method))
12
+ if opts[:to_instance_variable]
13
+ object = instance_variable_get("@#{opts.fetch(:to_instance_variable)}")
14
+ raise "Nothing was returned by: #{opts.fetch(:to_instance_variable)}" unless object
15
+ elsif opts[:to]
16
+ object = __send__(opts.fetch(:to))
17
+ raise "Nothing was returned by: #{opts.fetch(:to)}" unless object
16
18
  else
17
19
  raise "Don't know where to delegate to"
18
20
  end
19
21
 
20
- raise "Nothing was returned by: #{opts.fetch(:to_method)}" unless object
21
22
  object.__send__(method, *method_args, &method_blk)
22
23
  end
23
24
  end
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: simple_delegate 0.0.1 ruby lib
5
+ # stub: simple_delegate 0.0.2 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "simple_delegate"
9
- s.version = "0.0.1"
9
+ s.version = "0.0.2"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
13
13
  s.authors = ["kaspernj"]
14
- s.date = "2016-04-08"
14
+ s.date = "2016-04-09"
15
15
  s.description = "A simple library to delegate methods to instance variables"
16
16
  s.email = "k@spernj.org"
17
17
  s.extra_rdoc_files = [
@@ -3,7 +3,7 @@ require "spec_helper"
3
3
  class SampleClass1
4
4
  include SimpleDelegate
5
5
 
6
- delegate :method1, :method2, to: :object
6
+ delegate :method1, :method2, to_instance_variable: :object
7
7
 
8
8
  def initialize
9
9
  @object = SampleClass2.new
@@ -23,7 +23,7 @@ end
23
23
  class DelegateToMethods
24
24
  include SimpleDelegate
25
25
 
26
- delegate :method1, :method2, to_method: :spawn_object
26
+ delegate :method1, :method2, to: :spawn_object
27
27
 
28
28
  def spawn_object
29
29
  @object = SampleClass2.new
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_delegate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - kaspernj
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-08 00:00:00.000000000 Z
11
+ date: 2016-04-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec