tuner 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/tuner.rb +1 -0
- data/lib/tuner/decorator.rb +26 -0
- data/lib/tuner/version.rb +12 -0
- metadata +65 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 55afbe233eec9d186fefa44d5dda5df13452cdde99c6349fdcabed8eeee86990
|
4
|
+
data.tar.gz: e286a865895d2e96786704cbf4472cf022c247e000727a3f89d59d488bfbffb1
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8a0aab7b0a95ad5aa95112a71479bc022604655d05f7d31151daf870d1a0dd45de25a5df74311abbf55f914bea9a01b546b9aa537117699f2e6931f707096b4c
|
7
|
+
data.tar.gz: 76526230634b8619bd17ae7abefe165227307fe77a412e8d94e840fa0af49976f0c517abcf988636b3c18da480bee7ce17ec42af6c90dd87692495a0781d39f8
|
data/lib/tuner.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require_relative 'tuner/decorator'
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Tuner
|
2
|
+
class Decorator < SimpleDelegator
|
3
|
+
# Alias for accessing passed object
|
4
|
+
#
|
5
|
+
# @return [Object]
|
6
|
+
def model
|
7
|
+
__getobj__
|
8
|
+
end
|
9
|
+
|
10
|
+
alias_method :object, :model
|
11
|
+
|
12
|
+
# Shortcut for creating a new instance of decorator
|
13
|
+
#
|
14
|
+
# @return [Object]
|
15
|
+
def self.decorate(obj)
|
16
|
+
new(obj)
|
17
|
+
end
|
18
|
+
|
19
|
+
# Decorate each element in the passed array
|
20
|
+
#
|
21
|
+
# @return [Array]
|
22
|
+
def self.decorate_collection(collection)
|
23
|
+
collection.map { |element| new(element) }
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
metadata
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: tuner
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Paweł Dąbrowski
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-03-23 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rspec
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3.7'
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 3.7.0
|
23
|
+
type: :development
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - "~>"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '3.7'
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 3.7.0
|
33
|
+
description: A pure implementation of Decorator pattern
|
34
|
+
email: dziamber@gmail.com
|
35
|
+
executables: []
|
36
|
+
extensions: []
|
37
|
+
extra_rdoc_files: []
|
38
|
+
files:
|
39
|
+
- lib/tuner.rb
|
40
|
+
- lib/tuner/decorator.rb
|
41
|
+
- lib/tuner/version.rb
|
42
|
+
homepage:
|
43
|
+
licenses: []
|
44
|
+
metadata: {}
|
45
|
+
post_install_message:
|
46
|
+
rdoc_options: []
|
47
|
+
require_paths:
|
48
|
+
- lib
|
49
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ">="
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
55
|
+
requirements:
|
56
|
+
- - ">="
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
version: '0'
|
59
|
+
requirements: []
|
60
|
+
rubyforge_project:
|
61
|
+
rubygems_version: 2.7.6
|
62
|
+
signing_key:
|
63
|
+
specification_version: 4
|
64
|
+
summary: A pure implementation of Decorator pattern
|
65
|
+
test_files: []
|