konstructor 0.4.7 → 1.0.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/README.md +20 -11
  3. data/lib/konstructor/version.rb +1 -1
  4. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 60d74b10c2dc765e0f410b9aaedb1380fc95d99e
4
- data.tar.gz: 1a49238ace7f7abc0650f34703eee2131e3f534a
3
+ metadata.gz: 2b25aee9c2f472261bbcca0e6089870ac86288c7
4
+ data.tar.gz: 7189a66fc0ee859892a97a9534ad10ca02280af1
5
5
  SHA512:
6
- metadata.gz: befc712f9fc03b0b31c21b96c0fb0d8878240888fd409b72d1442d23c54589baf3e94698584236527322543996d6c552a7fea255c9e7b668dbba34f2e3302d52
7
- data.tar.gz: c653555abe700f34d8f3edd41fa60727fb0aa44163bc2063881b028613bdd845339fc2c7d00731841f0aebafe6f74df25064783b6d677d3f1382e1295b394739
6
+ metadata.gz: 19e2dd031b428fba484ad91b2f187ccb73453ddca97448ebe3d3c68884f1f569474515103abc66fe8af3234a08fe972f897f5ff80ba9b7b8098202ae9f70092a
7
+ data.tar.gz: 76f25aa0a032a26ed7246c27e6cd51a9390f3b770d6540bb6b795f0d622c3e65fdb5a01e203d00d89a67835535a0e3a0e5a0ea85163894b6f182b73d0b97bcdd
data/README.md CHANGED
@@ -1,10 +1,14 @@
1
1
  [![Gem Version](http://img.shields.io/gem/v/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
+ [![Code Climate](https://codeclimate.com/github/snovity/konstructor/badges/gpa.svg)][codeclimate]
5
+ [![Dependency Status](https://gemnasium.com/badges/github.com/snovity/konstructor.svg)][gemnasium]
4
6
 
5
7
  [gem]: https://rubygems.org/gems/konstructor
6
8
  [travis]: http://travis-ci.org/snovity/konstructor
7
9
  [coveralls]: https://coveralls.io/github/snovity/konstructor
10
+ [gemnasium]: https://gemnasium.com/snovity/konstructor
11
+ [codeclimate]: https://codeclimate.com/github/snovity/konstructor
8
12
 
9
13
  # Konstructor
10
14
 
@@ -116,7 +120,7 @@ and two additional ones.
116
120
  ```
117
121
 
118
122
  If you decide to remove the default Ruby constructor for some reason,
119
- you can effectively do it by marking it as private using Ruby
123
+ you can achieve the effect by marking it private with Ruby
120
124
  method `private_class_method`:
121
125
 
122
126
  ```ruby
@@ -187,6 +191,9 @@ class SomeClass
187
191
  @number = some_number
188
192
  end
189
193
  end
194
+
195
+ obj0 = SomeClass.create(3)
196
+ obj1 = SomeClass.create("three") # raises contract exception
190
197
  ```
191
198
 
192
199
  If you stumble upon a metaprogramming gem that
@@ -195,19 +202,20 @@ conflicts with Konstructor, please
195
202
 
196
203
  ## Details
197
204
 
198
- Ruby constructor is a pair consisting of public factory method defined
199
- on a class and a private instance method. Therefore, to achieve
200
- its goal `konstructor` marks instance method as private and defines a
205
+ The default Ruby constructor is a pair consisting of public
206
+ class method `new` and a private instance
207
+ method `initialize`. To create an additional one `konstructor`
208
+ marks given instance method as private and defines a
201
209
  corresponding public class method with the same name.
202
210
 
203
211
  #### Performance
204
212
 
205
- Konstructor does all its work when class is being defined. Once class
206
- has been defined, it's just standard Ruby instance creation.
207
- Therefore, there is no runtime performance penalty.
213
+ Using `konstructor` declaration has no runtime perfomance penalty,
214
+ since all work is done during class definition and then it's just
215
+ standard Ruby instance creation.
208
216
 
209
- As for the cost of declaring a constructor at initial load time,
210
- it's roughly the same as declaring 3 properties with `attr_accessor`.
217
+ Cost of `konstructor` declaration at initial load time is roughly the
218
+ same as declaring 3 properties with `attr_accessor`.
211
219
  ```ruby
212
220
  attr_accessor :one, :two, :three
213
221
 
@@ -219,9 +227,10 @@ it's roughly the same as declaring 3 properties with `attr_accessor`.
219
227
  See [Benchmarks page](https://github.com/snovity/konstructor/wiki/Benchmarks)
220
228
  for details.
221
229
 
222
- #### Dependencies
230
+ #### Dependencies and requirements
223
231
 
224
- Konstructor doesn't depend on other gems.
232
+ Konstructor doesn't depend on other gems.
233
+ Requires Ruby `2.0.0` or higher.
225
234
 
226
235
  #### Thread safety
227
236
 
@@ -1,3 +1,3 @@
1
1
  module Konstructor
2
- VERSION = '0.4.7'
2
+ VERSION = '1.0.0'
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: 0.4.7
4
+ version: 1.0.0
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-23 00:00:00.000000000 Z
11
+ date: 2017-01-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -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.5.1
188
+ rubygems_version: 2.4.8
189
189
  signing_key:
190
190
  specification_version: 4
191
191
  summary: Multiple constructors in Ruby.