konstructor 1.0.0 → 1.0.1

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: 2b25aee9c2f472261bbcca0e6089870ac86288c7
4
- data.tar.gz: 7189a66fc0ee859892a97a9534ad10ca02280af1
3
+ metadata.gz: 7f8f7d3b8b3ecacc95f4337c122cfc4512a77c54
4
+ data.tar.gz: 142074c98c848d53e43a813d20306d95f275323d
5
5
  SHA512:
6
- metadata.gz: 19e2dd031b428fba484ad91b2f187ccb73453ddca97448ebe3d3c68884f1f569474515103abc66fe8af3234a08fe972f897f5ff80ba9b7b8098202ae9f70092a
7
- data.tar.gz: 76f25aa0a032a26ed7246c27e6cd51a9390f3b770d6540bb6b795f0d622c3e65fdb5a01e203d00d89a67835535a0e3a0e5a0ea85163894b6f182b73d0b97bcdd
6
+ metadata.gz: 3ac30ef4daa2c4f8c90470b99012df4e506b7f81e846a8ab93d1f6e7407fcdf9d0887ef4e55db0dc02811c97dfffe0cc5ea58372ee59b18d4c22790689887629
7
+ data.tar.gz: c09a1ea90372ed7a4b49facfabdc84a21df96032095dc01ed2947fb9d4bc3b0c2c3d4eeacd3b874c708093c32fa70ad74664f5a944d43ed02311f329c7d9409d
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- [![Gem Version](http://img.shields.io/gem/v/konstructor.svg)][gem]
1
+ [![Gem Version](https://badge.fury.io/rb/konstructor.svg)][gem]
2
2
  [![Build Status](https://travis-ci.org/snovity/konstructor.svg?branch=master)][travis]
3
3
  [![Coverage Status](https://coveralls.io/repos/github/snovity/konstructor/badge.svg?branch=master)][coveralls]
4
4
  [![Code Climate](https://codeclimate.com/github/snovity/konstructor/badges/gpa.svg)][codeclimate]
@@ -174,6 +174,30 @@ see
174
174
  [Limitations page](https://github.com/snovity/konstructor/wiki/Limitations)
175
175
  for details.
176
176
 
177
+ #### Reusing default constructor
178
+
179
+ Sometimes you don't want to completely replace the default constructor,
180
+ instead you just want to add additional processing before/after it.
181
+ ```ruby
182
+ class Person
183
+ def initialize(name)
184
+ @name = name
185
+ @word_count = name.split(' ').size
186
+ end
187
+
188
+ konstructor
189
+ def from_two_names(first_name, second_name)
190
+ initialize(first_name + ' ' + second_name)
191
+ @name_count = 2
192
+ end
193
+
194
+ attr_reader :name, :word_count, :name_count
195
+ end
196
+
197
+ Person.new('John Doe')
198
+ Person.from_two_names('John', 'Doe')
199
+ ```
200
+
177
201
  #### Using with other gems
178
202
 
179
203
  Konstructor doesn't affect other gems depending on metaprogramming,
@@ -182,7 +206,7 @@ such as
182
206
  [thor](https://github.com/erikhuda/thor),
183
207
  [contracts](https://github.com/egonSchiele/contracts.ruby), etc.
184
208
 
185
- For instnace, this is how Konstructor works with contracts:
209
+ For instnace, this is how Konstructor works with Contracts:
186
210
  ```ruby
187
211
  class SomeClass
188
212
  konstructor
@@ -230,7 +254,7 @@ for details.
230
254
  #### Dependencies and requirements
231
255
 
232
256
  Konstructor doesn't depend on other gems.
233
- Requires Ruby `2.0.0` or higher.
257
+ Requires Ruby `1.9.3` or higher.
234
258
 
235
259
  #### Thread safety
236
260
 
data/konstructor.gemspec CHANGED
@@ -15,7 +15,7 @@ Gem::Specification.new do |spec|
15
15
  }
16
16
  spec.homepage = 'https://github.com/snovity/konstructor'
17
17
  spec.license = 'MIT'
18
- spec.required_ruby_version = '>= 2.0.0'
18
+ spec.required_ruby_version = '>= 1.9.3'
19
19
 
20
20
  spec.files = `git ls-files -z`.split("\x0").reject do |f|
21
21
  f.match(%r{^(test|spec|features)/})
@@ -1,3 +1,3 @@
1
1
  module Konstructor
2
- VERSION = '1.0.0'
2
+ VERSION = '1.0.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: konstructor
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dima Lashkov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-01-25 00:00:00.000000000 Z
11
+ date: 2017-01-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -177,7 +177,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
177
177
  requirements:
178
178
  - - ">="
179
179
  - !ruby/object:Gem::Version
180
- version: 2.0.0
180
+ version: 1.9.3
181
181
  required_rubygems_version: !ruby/object:Gem::Requirement
182
182
  requirements:
183
183
  - - ">="
@@ -185,7 +185,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
185
185
  version: '0'
186
186
  requirements: []
187
187
  rubyforge_project:
188
- rubygems_version: 2.4.8
188
+ rubygems_version: 2.5.1
189
189
  signing_key:
190
190
  specification_version: 4
191
191
  summary: Multiple constructors in Ruby.