kwstruct 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b437daa6c83925a4e6596ca5f1a277a409061dbd
4
+ data.tar.gz: 26dcfed74953abc501069b3ab4297e2587893cc7
5
+ SHA512:
6
+ metadata.gz: 91a469addaf49fb484d3c74d4edcd0492cfc911b2bdac963e2c356f99a4eeb0a833f0e814991700b64e7758ef101fd8270d3bd4f5a40bfd69b410656a78d8286
7
+ data.tar.gz: 33440dceab4f8278a55c4ebdd6e5962a18b28c417487cf7906c53764e07bf37f7ae6c832e9c9ad484cf04a9545cb9e986655a76dd0a481caa4b6e17515d581fa
@@ -0,0 +1,13 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
4
+
5
+ We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, age, or religion.
6
+
7
+ Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
8
+
9
+ Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
10
+
11
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
12
+
13
+ This Code of Conduct is adapted from the [Contributor Covenant](http:contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Maxim Chernyak
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,14 @@
1
+ # kwstruct
2
+
3
+ Just like regular Struct, but uses keyword arguments.
4
+
5
+ ```ruby
6
+ Person = KwStruct.new(:name, :age)
7
+ sammy = Person.new(name: 'Sammy', age: 30)
8
+ ```
9
+
10
+ Any non-existent arguments will raise an ArgumentError.
11
+
12
+ ## Installation
13
+
14
+ $ gem install kwstruct
data/kwstruct.gemspec ADDED
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'kwstruct'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'kwstruct'
8
+ spec.version = KwStruct::VERSION
9
+ spec.authors = ['Maxim Chernyak']
10
+ spec.email = ['max@bitsonnet.com']
11
+
12
+ spec.summary = 'Struct with keyword arguments support'
13
+ spec.homepage = 'https://github.com/maxim/kwstruct'
14
+ spec.license = 'MIT'
15
+
16
+ spec.files = %w(
17
+ CODE_OF_CONDUCT.md
18
+ LICENSE.txt
19
+ README.md
20
+ kwstruct.gemspec
21
+ lib/kwstruct.rb
22
+ )
23
+
24
+ spec.require_paths = ['lib']
25
+ end
data/lib/kwstruct.rb ADDED
@@ -0,0 +1,12 @@
1
+ class KwStruct < Struct
2
+ VERSION = '0.1.0'
3
+
4
+ def self.new(*members)
5
+ class_eval <<-RUBY
6
+ def initialize(#{members.map{|m| "#{m}: nil"}.join(', ')})
7
+ super(#{members.join(', ')})
8
+ end
9
+ RUBY
10
+ super
11
+ end
12
+ end
metadata ADDED
@@ -0,0 +1,50 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: kwstruct
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Maxim Chernyak
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-03-22 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description:
14
+ email:
15
+ - max@bitsonnet.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - CODE_OF_CONDUCT.md
21
+ - LICENSE.txt
22
+ - README.md
23
+ - kwstruct.gemspec
24
+ - lib/kwstruct.rb
25
+ homepage: https://github.com/maxim/kwstruct
26
+ licenses:
27
+ - MIT
28
+ metadata: {}
29
+ post_install_message:
30
+ rdoc_options: []
31
+ require_paths:
32
+ - lib
33
+ required_ruby_version: !ruby/object:Gem::Requirement
34
+ requirements:
35
+ - - ">="
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ required_rubygems_version: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: '0'
43
+ requirements: []
44
+ rubyforge_project:
45
+ rubygems_version: 2.4.5
46
+ signing_key:
47
+ specification_version: 4
48
+ summary: Struct with keyword arguments support
49
+ test_files: []
50
+ has_rdoc: