silueta 0.0.1

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: 8167fc7754eab658c56863120e47c1719570bf83
4
+ data.tar.gz: a5de31e48dc49e2d963b1330a314dd6a3f39ed5b
5
+ SHA512:
6
+ metadata.gz: fd21d45279aaca313f8aa63427763ec9511b2d67dd7d8772617f4d16c6d37b250b6b02d84662dfb0b0fb3fe18c22d6446991aa8b0a24c62ccf5d674274f66533
7
+ data.tar.gz: 3bdd699cfe9677f71ae98cf7000bfb6bc543f919009fa9c1e091e21156c04aafc8b4795efa3d8c2e079e10dd25089528b774e0e86a5bcf6d042d13a3b8863794
data/.gitignore ADDED
@@ -0,0 +1,2 @@
1
+ /Gemfile.lock
2
+ /pkg/
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Mayn Kjær
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,29 @@
1
+ # silueta
2
+
3
+ Initialize an object with a hash of attributes.
4
+
5
+ ## Usage
6
+
7
+ ```ruby
8
+ require "silueta"
9
+
10
+ class User
11
+ include Silueta
12
+
13
+ attr_accessor :first_name, :last_name, :email
14
+ end
15
+
16
+ user = User.new(
17
+ first_name: "Mayn",
18
+ last_name: "Kjaer",
19
+ email: "mayn@mail.com"
20
+ )
21
+
22
+ puts user.first_name # => "Mayn"
23
+ puts user.last_name # => "Kjaer"
24
+ puts user.email # => "mayn@mail.com"
25
+ ```
26
+
27
+ ## Installation
28
+
29
+ `$ gem install silueta`
@@ -0,0 +1,3 @@
1
+ module Silueta
2
+ VERSION = "0.0.1"
3
+ end
data/lib/silueta.rb ADDED
@@ -0,0 +1,9 @@
1
+ require_relative "silueta/version"
2
+
3
+ module Silueta
4
+ def initialize(attrs = {})
5
+ attrs.each do |name, value|
6
+ self.public_send("#{ name }=", value)
7
+ end
8
+ end
9
+ end
data/makefile ADDED
@@ -0,0 +1,2 @@
1
+ default:
2
+ cutest test/*_test.rb
data/silueta.gemspec ADDED
@@ -0,0 +1,17 @@
1
+ require_relative "lib/silueta/version"
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = "silueta"
5
+ s.version = Silueta::VERSION
6
+ s.summary = "Initialize an object with a hash of attributes"
7
+ s.description = s.summary
8
+ s.authors = ["Mayn Ektvedt Kjær"]
9
+ s.email = ["mayn.kjaer@gmail.com"]
10
+ s.homepage = "https://github.com/harmoni/silueta"
11
+ s.license = "MIT"
12
+
13
+ s.files = `git ls-files`.split("\n")
14
+
15
+ s.add_development_dependency "bundler", "~> 1.10"
16
+ s.add_development_dependency "cutest", "~> 1.2"
17
+ end
@@ -0,0 +1,18 @@
1
+ require "bundler/setup"
2
+ require "cutest"
3
+ require_relative "../lib/silueta"
4
+
5
+ class User
6
+ include Silueta
7
+
8
+ attr_accessor :name, :email
9
+ end
10
+
11
+ scope do
12
+ test "initialize" do
13
+ user = User.new(name: "Mayn", email: "mayn@mail.com")
14
+
15
+ assert_equal("Mayn", user.name)
16
+ assert_equal("mayn@mail.com", user.email)
17
+ end
18
+ end
metadata ADDED
@@ -0,0 +1,81 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: silueta
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Mayn Ektvedt Kjær
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-08-24 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.10'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.10'
27
+ - !ruby/object:Gem::Dependency
28
+ name: cutest
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.2'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.2'
41
+ description: Initialize an object with a hash of attributes
42
+ email:
43
+ - mayn.kjaer@gmail.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - ".gitignore"
49
+ - Gemfile
50
+ - LICENSE
51
+ - README.md
52
+ - lib/silueta.rb
53
+ - lib/silueta/version.rb
54
+ - makefile
55
+ - silueta.gemspec
56
+ - test/silueta_test.rb
57
+ homepage: https://github.com/harmoni/silueta
58
+ licenses:
59
+ - MIT
60
+ metadata: {}
61
+ post_install_message:
62
+ rdoc_options: []
63
+ require_paths:
64
+ - lib
65
+ required_ruby_version: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ required_rubygems_version: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ requirements: []
76
+ rubyforge_project:
77
+ rubygems_version: 2.4.5.1
78
+ signing_key:
79
+ specification_version: 4
80
+ summary: Initialize an object with a hash of attributes
81
+ test_files: []