hcast 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,37 @@
1
+ require 'spec_helper'
2
+
3
+ describe HCast do
4
+
5
+ describe ".create" do
6
+ it "should cast hash attributes" do
7
+ pending "NOT YET IMPLEMENTED"
8
+ input_hash = {
9
+ contact: {
10
+ name: "John Smith",
11
+ age: "22",
12
+ company: {
13
+ name: "MyCo",
14
+ }
15
+ }
16
+ }
17
+
18
+ caster = HCast.create do
19
+ hash :contact do
20
+ string :name
21
+ integer :age
22
+ hash :company do
23
+ string :name
24
+ end
25
+ end
26
+
27
+ def registered?
28
+ true
29
+ end
30
+ end
31
+
32
+ casted_hash = caster.cast(input_hash)
33
+ casted_hash.object_id.should_not == hash.object_id
34
+ caster_hash.should == hash
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,8 @@
1
+ require 'rubygems'
2
+ require 'bundler/setup'
3
+ require 'debugger'
4
+ require 'hcast'
5
+
6
+ RSpec.configure do |config|
7
+ config.color_enabled = true
8
+ end
metadata ADDED
@@ -0,0 +1,113 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: hcast
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.0.1
6
+ platform: ruby
7
+ authors:
8
+ - Albert Gazizov
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2014-02-24 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ version_requirements: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ none: false
21
+ name: bundler
22
+ type: :development
23
+ prerelease: false
24
+ requirement: !ruby/object:Gem::Requirement
25
+ requirements:
26
+ - - ~>
27
+ - !ruby/object:Gem::Version
28
+ version: '1.3'
29
+ none: false
30
+ - !ruby/object:Gem::Dependency
31
+ version_requirements: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - ! '>='
34
+ - !ruby/object:Gem::Version
35
+ version: '0'
36
+ none: false
37
+ name: rake
38
+ type: :development
39
+ prerelease: false
40
+ requirement: !ruby/object:Gem::Requirement
41
+ requirements:
42
+ - - ! '>='
43
+ - !ruby/object:Gem::Version
44
+ version: '0'
45
+ none: false
46
+ description: Hash Caster and Validator
47
+ email:
48
+ - deeper4k@gmail.com
49
+ executables: []
50
+ extensions: []
51
+ extra_rdoc_files: []
52
+ files:
53
+ - .gitignore
54
+ - .travis.yml
55
+ - Gemfile
56
+ - Gemfile.lock
57
+ - LICENSE.txt
58
+ - README.md
59
+ - Rakefile
60
+ - hcast.gemspec
61
+ - lib/hcast.rb
62
+ - lib/hcast/attributes_caster.rb
63
+ - lib/hcast/attributes_parser.rb
64
+ - lib/hcast/caster.rb
65
+ - lib/hcast/casters.rb
66
+ - lib/hcast/casters/array_caster.rb
67
+ - lib/hcast/casters/boolean_caster.rb
68
+ - lib/hcast/casters/date_caster.rb
69
+ - lib/hcast/casters/datetime_caster.rb
70
+ - lib/hcast/casters/float_caster.rb
71
+ - lib/hcast/casters/hash_caster.rb
72
+ - lib/hcast/casters/integer_caster.rb
73
+ - lib/hcast/casters/string_caster.rb
74
+ - lib/hcast/casters/symbol_caster.rb
75
+ - lib/hcast/casters/time_caster.rb
76
+ - lib/hcast/concern.rb
77
+ - lib/hcast/config.rb
78
+ - lib/hcast/errors.rb
79
+ - lib/hcast/metadata/attribute.rb
80
+ - lib/hcast/version.rb
81
+ - spec/hcast/caster_spec.rb
82
+ - spec/hcast/hcast_spec.rb
83
+ - spec/spec_helper.rb
84
+ homepage: http://github.com/AlbertGazizov/hcast
85
+ licenses:
86
+ - MIT
87
+ post_install_message:
88
+ rdoc_options: []
89
+ require_paths:
90
+ - lib
91
+ required_ruby_version: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - ! '>='
94
+ - !ruby/object:Gem::Version
95
+ version: '0'
96
+ none: false
97
+ required_rubygems_version: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ none: false
103
+ requirements: []
104
+ rubyforge_project:
105
+ rubygems_version: 1.8.23
106
+ signing_key:
107
+ specification_version: 3
108
+ summary: Hash Caster and Validator
109
+ test_files:
110
+ - spec/hcast/caster_spec.rb
111
+ - spec/hcast/hcast_spec.rb
112
+ - spec/spec_helper.rb
113
+ has_rdoc: