nd_transcriber 0.0.1
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 +7 -0
- data/lib/nd_transcriber.rb +52 -0
- metadata +44 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: b38a8fc84b338d68d21a77e46d9701cb45d5fd3d
|
4
|
+
data.tar.gz: 2b2809662477271a5fc709cc62a2b075a270f427
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d56af65d922c2e2935793eb95a496b15667f51e468bbfa70c693b4148f2886e48924ac69859256acb93b11769ac31ad0c6dee4190c9b9bab6e1c1d87a5991b5b
|
7
|
+
data.tar.gz: fb679153664c21ad718cea94af008d71dca4751837745c7885bd0521416f9c225d51a2a61b0cd46b2b6642e483fda14cbb81d97cc8446e2a807d0e01938746cf
|
@@ -0,0 +1,52 @@
|
|
1
|
+
module NdTranscriber
|
2
|
+
def self.included base
|
3
|
+
base.class_eval do
|
4
|
+
extend ClassMethods
|
5
|
+
end
|
6
|
+
end
|
7
|
+
|
8
|
+
def transcribe origin, &block
|
9
|
+
copier = Copier.new(origin, self)
|
10
|
+
copier.instance_exec self, &self.class.transcribe_block if self.class.transcribe_block
|
11
|
+
copier.instance_exec self, &block if block
|
12
|
+
self
|
13
|
+
end
|
14
|
+
|
15
|
+
module ClassMethods
|
16
|
+
def transcribe_block
|
17
|
+
@transcribe_block
|
18
|
+
end
|
19
|
+
|
20
|
+
def transcribe_block=(transcribe_block)
|
21
|
+
@transcribe_block = transcribe_block
|
22
|
+
end
|
23
|
+
|
24
|
+
def transcribes_to_block
|
25
|
+
@transcribes_to_block
|
26
|
+
end
|
27
|
+
|
28
|
+
def transcribes_to_block=(transcribes_to_block)
|
29
|
+
@transcribes_to_block = transcribes_to_block
|
30
|
+
end
|
31
|
+
|
32
|
+
def transcriber &block
|
33
|
+
self.transcribe_block = block
|
34
|
+
end
|
35
|
+
|
36
|
+
def transcribes_to &block
|
37
|
+
self.transcribes_to_block = block
|
38
|
+
end
|
39
|
+
|
40
|
+
def transcribe origin, &block
|
41
|
+
destination = (transcribes_to_block && instance_exec(origin,
|
42
|
+
&transcribes_to_block)) || new
|
43
|
+
destination.transcribe origin, &block
|
44
|
+
end
|
45
|
+
|
46
|
+
def transcribe_all origins, &block
|
47
|
+
origins.collect { |origin| transcribe origin, &block }
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
require 'nd_transcriber/copier'
|
metadata
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: nd_transcriber
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Diego Aguir Selzlein
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-08-19 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: This gem provides an easy way to copy attributes around.
|
14
|
+
email: diegoselzlein@gmail.com
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- lib/nd_transcriber.rb
|
20
|
+
homepage: https://github.com/nerde/nd_transcriber
|
21
|
+
licenses:
|
22
|
+
- MIT
|
23
|
+
metadata: {}
|
24
|
+
post_install_message:
|
25
|
+
rdoc_options: []
|
26
|
+
require_paths:
|
27
|
+
- lib
|
28
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
29
|
+
requirements:
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
34
|
+
requirements:
|
35
|
+
- - ">="
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
requirements: []
|
39
|
+
rubyforge_project:
|
40
|
+
rubygems_version: 2.2.2
|
41
|
+
signing_key:
|
42
|
+
specification_version: 4
|
43
|
+
summary: Copy object's attributes with ease.
|
44
|
+
test_files: []
|