entasis 0.5.0.rc2 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ YzRmZmE2ODA5MTRkMDMxODZiODFlNDljMzA2MDEyYmQxNWYwMTE1YQ==
5
+ data.tar.gz: !binary |-
6
+ OGNkYTA0MDZkN2VmMzBkMDU1NzRkNzMwNzEzNGQzMWRmNTNiMmI4NA==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ OTNlYWE4OTAyZmMwMmM1Y2ZhNzA4MmQ2MmNkMTM4ZGNjMDg4Y2Y2MDQ1NGQ4
10
+ MTIyMDU4OWU1Y2U1MjdhZWY1ZjY2N2QyZTY3ZDdmOGZjNzk1NWI0MGZkZGFi
11
+ MzM4OGY4NWEzMzQ1YzQzNGVjZjBhYjEyMzEzMGFjMGYwNmFmMDQ=
12
+ data.tar.gz: !binary |-
13
+ NjVhODIwMGY1ZjdjYTU4ODQxZDIzYTlhZTk2ZjkwZmU4OWQxMTA0ZjU2YmU4
14
+ MzY0MzVjMDdjZTZiNzk4Y2RiM2UyNWVmZDdkMGNmYjY5NDEyZmFmZTk2ODc4
15
+ YWJkNzdmNzlkYzU4OWU1NjE2MGFlODE5MWU1YWJlNTkzMDQ2YTM=
data/README.md CHANGED
@@ -12,39 +12,59 @@ Example:
12
12
  class Person
13
13
  include Entasis::Model
14
14
 
15
- has_many :friends
16
-
17
15
  attributes :name, :age, :city
18
16
 
17
+ validates :name, presence: true
18
+
19
19
  def age=(years)
20
20
  @age = years.to_i
21
21
  end
22
22
  end
23
23
 
24
- class Friend
24
+ person = Person.new name: 'Hilda', age: '23', city: 'Stockholm' }
25
+
26
+ person.attribute_names # => ["name", "age", "city"]
27
+ person.attributes # => {"name"=>"Hilda", "age"=>23, "city"=>"Stockholm"}
28
+
29
+ anon = Person.new
30
+ anon.valid? # => false
31
+ anon.errors # => {:name=>["can't be blank"]}>
32
+ ```
33
+
34
+ Default behavior is to raise if any key in the hash given to `.new` or `#attributes=` is not defined,
35
+ this can be circumvented by passing `ignore_undefined: true` as options when defining your attributes.
36
+
37
+
38
+ Relations
39
+ ---------
40
+
41
+ You can build simple relations between objects.
42
+
43
+ Example:
44
+
45
+ ```ruby
46
+ class Person
25
47
  include Entasis::Model
26
48
 
27
- belongs_to :best_friend, class: 'Person'
49
+ has_many :friends
28
50
 
29
51
  attributes :name
30
52
  end
31
53
 
54
+ class Friend
55
+ include Entasis::Model
32
56
 
33
- hilda = Person.new(name: 'Hilda', age: '23', city: 'Stockholm', friends: [{ name: 'Emma' }, { name: 'Johan' }])
57
+ belongs_to :best_friend, class: 'Person'
34
58
 
35
- hilda.attribute_names # => ["name", "age", "city"]
36
- hilda.attributes # => {"name"=>"Hilda", "age"=>23, "city"=>"Stockholm"}
59
+ attributes :name
60
+ end
37
61
 
38
- hilda.friends # => [#<Friend:0x0 @name="Emma">, #<Friend:0x1 @name="Johan">]
39
- hilda.friends[0].best_friend == hilda # => true
40
62
 
41
- anon = Person.new
42
- anon.valid? # => false
43
- anon.errors # => {:name=>["can't be blank"]}>
44
- ```
63
+ person = Person.new name: 'Anna', friends: [{ name: 'Emma' }, { name: 'Johan' }]
45
64
 
46
- Default behavior is to raise if any key in the hash given to `.new` or `#attributes=` is not defined,
47
- this can be circumvented by passing `ignore_undefined: true` as options when defining your attributes.
65
+ person.friends # => [#<Friend:0x0 @name="Emma">, #<Friend:0x1 @name="Johan">]
66
+ person.friends[0].best_friend == person # => true
67
+ ```
48
68
 
49
69
 
50
70
  Transposing keys
data/entasis.gemspec CHANGED
@@ -16,6 +16,6 @@ Gem::Specification.new do |s|
16
16
  s.files = Dir.glob("lib/**/*") + %w(Gemfile entasis.gemspec HISTORY README.md LICENSE)
17
17
  s.test_files = Dir.glob('spec/*')
18
18
 
19
- s.add_runtime_dependency 'activemodel', '~> 3.0'
19
+ s.add_runtime_dependency 'activemodel', '~> 3.1'
20
20
  s.add_development_dependency 'rspec', '~> 2.0'
21
21
  end
@@ -1,3 +1,3 @@
1
1
  module Entasis
2
- VERSION = "0.5.0.rc2"
2
+ VERSION = "0.5.0"
3
3
  end
metadata CHANGED
@@ -1,36 +1,32 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: entasis
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0.rc2
5
- prerelease: 6
4
+ version: 0.5.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Ingemar Edsborn
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-02-20 00:00:00.000000000 Z
11
+ date: 2013-03-01 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: activemodel
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ~>
20
18
  - !ruby/object:Gem::Version
21
- version: '3.0'
19
+ version: '3.1'
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ~>
28
25
  - !ruby/object:Gem::Version
29
- version: '3.0'
26
+ version: '3.1'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: rspec
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
31
  - - ~>
36
32
  - !ruby/object:Gem::Version
@@ -38,7 +34,6 @@ dependencies:
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
38
  - - ~>
44
39
  - !ruby/object:Gem::Version
@@ -68,27 +63,26 @@ files:
68
63
  - spec/transpose_keys_spec.rb
69
64
  homepage: http://github.com/ingemar/entasis
70
65
  licenses: []
66
+ metadata: {}
71
67
  post_install_message:
72
68
  rdoc_options: []
73
69
  require_paths:
74
70
  - lib
75
71
  required_ruby_version: !ruby/object:Gem::Requirement
76
- none: false
77
72
  requirements:
78
73
  - - ! '>='
79
74
  - !ruby/object:Gem::Version
80
75
  version: '0'
81
76
  required_rubygems_version: !ruby/object:Gem::Requirement
82
- none: false
83
77
  requirements:
84
- - - ! '>'
78
+ - - ! '>='
85
79
  - !ruby/object:Gem::Version
86
- version: 1.3.1
80
+ version: '0'
87
81
  requirements: []
88
82
  rubyforge_project:
89
- rubygems_version: 1.8.24
83
+ rubygems_version: 2.0.0
90
84
  signing_key:
91
- specification_version: 3
85
+ specification_version: 4
92
86
  summary: A few neat methods for a basic class
93
87
  test_files:
94
88
  - spec/entasis_spec.rb