sorting_service_books 0.2.0 → 0.2.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 50cf00ef383a5e93cdc68f83d4651cb91a542cd2
4
- data.tar.gz: 5336d33c190b31202768a7875e6263f7de1c9a39
3
+ metadata.gz: 67daab01a35395ce170ad9044ed40c98715631e1
4
+ data.tar.gz: a1b060cd45f53c589d177f346d69f4fe1b04e177
5
5
  SHA512:
6
- metadata.gz: 19896eae6c581a736949a3a2caada789e3ea3cc031869cb0cad1c6282f8e97dc91c9c454fe957571ad460af1a0ee18ac2ad8d46a7a46cd127be38920bb9be7f5
7
- data.tar.gz: 4c3c1eddabca86e2a72dc8809069259cc1225e2622cfe426106e0208c85e23475afd19eb10dffef349146e5ef34c852b42640cd9f1cf77dddeb4f109e2b0cac5
6
+ metadata.gz: 70959e099ea7c97ef1e05bf7786c488b9c20253f7708025d2280136124c86bc409181f088d1e45738b0994f8b893b36bc805e3da65cc8b524a0fba771f67fedc
7
+ data.tar.gz: 32001feb6ea9261ffe633e0ecfde0c52d9b82f3a5de8388835f50558b95a581f6d9176f18250f7f896345df7d9f55373fc170321be7603189f4e8d6c1174dc18
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0
1
+ 0.2.1
data/bin/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.2.1
@@ -0,0 +1,22 @@
1
+ conditions:
2
+ -
3
+ key: !ruby/symbol title
4
+ value: !ruby/symbol asc
5
+
6
+ books:
7
+ -
8
+ title: 'Java How to Program'
9
+ author: 'Deitel & Deitel'
10
+ edition: '2007'
11
+ -
12
+ title: 'Patterns of Enterprise Application Architecture'
13
+ author: 'Martin Fowler'
14
+ edition: '2002'
15
+ -
16
+ title: 'Head First Design Patterns'
17
+ author: 'Elisabeth Freeman'
18
+ edition: '2004'
19
+ -
20
+ title: 'Internet & World Wide Web: How to Program'
21
+ author: 'Deitel & Deitel'
22
+ edition: '2007'
@@ -0,0 +1,28 @@
1
+ conditions:
2
+ -
3
+ key: !ruby/symbol edition
4
+ value: !ruby/symbol desc
5
+ -
6
+ key: !ruby/symbol author
7
+ value: !ruby/symbol desc
8
+ -
9
+ key: !ruby/symbol title
10
+ value: !ruby/symbol asc
11
+
12
+ books:
13
+ -
14
+ title: 'Java How to Program'
15
+ author: 'Deitel & Deitel'
16
+ edition: '2007'
17
+ -
18
+ title: 'Patterns of Enterprise Application Architecture'
19
+ author: 'Martin Fowler'
20
+ edition: '2002'
21
+ -
22
+ title: 'Head First Design Patterns'
23
+ author: 'Elisabeth Freeman'
24
+ edition: '2004'
25
+ -
26
+ title: 'Internet & World Wide Web: How to Program'
27
+ author: 'Deitel & Deitel'
28
+ edition: '2007'
@@ -0,0 +1,26 @@
1
+ conditions:
2
+ -
3
+ key: !ruby/symbol author
4
+ value: !ruby/symbol asc
5
+
6
+ -
7
+ key: !ruby/symbol title
8
+ value: !ruby/symbol desc
9
+
10
+ books:
11
+ -
12
+ title: 'Java How to Program'
13
+ author: 'Deitel & Deitel'
14
+ edition: '2007'
15
+ -
16
+ title: 'Patterns of Enterprise Application Architecture'
17
+ author: 'Martin Fowler'
18
+ edition: '2002'
19
+ -
20
+ title: 'Head First Design Patterns'
21
+ author: 'Elisabeth Freeman'
22
+ edition: '2004'
23
+ -
24
+ title: 'Internet & World Wide Web: How to Program'
25
+ author: 'Deitel & Deitel'
26
+ edition: '2007'
@@ -0,0 +1 @@
1
+ conditions:
@@ -0,0 +1,45 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bundler/setup'
4
+ $:.unshift File.join(File.dirname(__FILE__), "..", "lib")
5
+ require "sorting_service_books"
6
+
7
+
8
+ books = []
9
+ books << SortingServiceBooks::Book.new("Java How to Program", "Deitel & Deitel", "2007")
10
+ books << SortingServiceBooks::Book.new("Patterns of Enterprise Application Architecture", "Martin Fowler", "2002")
11
+ books << SortingServiceBooks::Book.new("Head First Design Patterns", "Elisabeth Freeman", "2004")
12
+ books << SortingServiceBooks::Book.new("Internet & World Wide Web: How to Program", "Deitel & Deitel", "2007")
13
+
14
+ conditions1 = []
15
+ conditions1 << SortingServiceBooks::Order.new(:title, :asc)
16
+
17
+ conditions2 = []
18
+ conditions2 << SortingServiceBooks::Order.new(:author, :asc)
19
+ conditions2 << SortingServiceBooks::Order.new(:title, :desc)
20
+
21
+ conditions3 = []
22
+ conditions3 << SortingServiceBooks::Order.new(:edition, :desc)
23
+ conditions3 << SortingServiceBooks::Order.new(:author, :desc)
24
+ conditions3 << SortingServiceBooks::Order.new(:title, :asc)
25
+
26
+ sort_books1 = SortingServiceBooks::SortBooks.new(books, conditions1)
27
+ sort_books2 = SortingServiceBooks::SortBooks.new(books, conditions2)
28
+ sort_books3 = SortingServiceBooks::SortBooks.new(books, conditions3)
29
+
30
+ sort_books1.books.each {|book| puts book.title+"--"+book.author+"--"+book.edition}
31
+ puts "_"*50
32
+ sort_books1.sort.each {|book| puts book.title+"--"+book.author+"--"+book.edition}
33
+ puts "#"*50
34
+ puts
35
+
36
+ sort_books2.books.each {|book| puts book.title+"--"+book.author+"--"+book.edition}
37
+ puts "_"*50
38
+ sort_books2.sort.each {|book| puts book.title+"--"+book.author+"--"+book.edition}
39
+ puts "#"*50
40
+ puts
41
+
42
+ sort_books3.books.each {|book| puts book.title+"--"+book.author+"--"+book.edition}
43
+ puts "_"*50
44
+ sort_books3.sort.each {|book| puts book.title+"--"+book.author+"--"+book.edition}
45
+ puts "#"*50
data/bin/test.rb CHANGED
@@ -1,24 +1,30 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require 'bundler/setup'
4
+ $:.unshift File.join(File.dirname(__FILE__), "..", "lib")
4
5
  require "sorting_service_books"
5
6
 
6
7
 
7
- client = Client.new("../config_one_condition.yml")
8
+ client = SortingServiceBooks::Client.new("config_one_condition.yml")
8
9
  puts "*"*50
9
- puts client.books
10
- puts client.sort
10
+ client.books.each { |c| puts c.title }
11
+ puts "-"*50
12
+ client.sort.each { |c| puts c.title }
11
13
  puts "*"*50
14
+ puts
12
15
 
13
- client = Client.new("../config_two_conditions.yml")
16
+ client = SortingServiceBooks::Client.new("config_two_conditions.yml")
14
17
  puts "*"*50
15
- puts client.books
16
- puts client.sort
18
+ client.books.each { |c| puts c.title }
19
+ puts "-"*50
20
+ client.sort.each { |c| puts c.title }
17
21
  puts "*"*50
22
+ puts
18
23
 
19
- client = Client.new("../config_three_conditions.yml")
24
+ client = SortingServiceBooks::Client.new("config_three_conditions.yml")
20
25
  puts "*"*50
21
- puts client.books
22
- puts client.sort
26
+ client.books.each { |c| puts c.title }
27
+ puts "-"*50
28
+ client.sort.each { |c| puts c.title }
23
29
  puts "*"*50
24
30
 
@@ -1,4 +1,5 @@
1
1
  module SortingServiceBooks
2
+
2
3
  class Client
3
4
  attr_accessor :books
4
5
 
@@ -5,14 +5,14 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "sorting_service_books"
8
- s.version = "0.2.0"
8
+ s.version = "0.2.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Douglas Petronilio"]
12
12
  s.date = "2014-06-02"
13
13
  s.description = "Gem to sorting a collection of the books by any atributes."
14
14
  s.email = "dougpetronilio@gmail.com"
15
- s.executables = ["test.rb"]
15
+ s.executables = ["VERSION", "config_one_condition.yml", "config_three_conditions.yml", "config_two_conditions.yml", "config_without_condition.yml", "service_books.rb", "test.rb"]
16
16
  s.extra_rdoc_files = [
17
17
  "LICENSE.txt",
18
18
  "README.rdoc"
@@ -26,6 +26,12 @@ Gem::Specification.new do |s|
26
26
  "README.rdoc",
27
27
  "Rakefile",
28
28
  "VERSION",
29
+ "bin/VERSION",
30
+ "bin/config_one_condition.yml",
31
+ "bin/config_three_conditions.yml",
32
+ "bin/config_two_conditions.yml",
33
+ "bin/config_without_condition.yml",
34
+ "bin/service_books.rb",
29
35
  "bin/test.rb",
30
36
  "config_one_condition.yml",
31
37
  "config_three_conditions.yml",
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sorting_service_books
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Douglas Petronilio
@@ -83,6 +83,12 @@ dependencies:
83
83
  description: Gem to sorting a collection of the books by any atributes.
84
84
  email: dougpetronilio@gmail.com
85
85
  executables:
86
+ - VERSION
87
+ - config_one_condition.yml
88
+ - config_three_conditions.yml
89
+ - config_two_conditions.yml
90
+ - config_without_condition.yml
91
+ - service_books.rb
86
92
  - test.rb
87
93
  extensions: []
88
94
  extra_rdoc_files:
@@ -97,6 +103,12 @@ files:
97
103
  - README.rdoc
98
104
  - Rakefile
99
105
  - VERSION
106
+ - bin/VERSION
107
+ - bin/config_one_condition.yml
108
+ - bin/config_three_conditions.yml
109
+ - bin/config_two_conditions.yml
110
+ - bin/config_without_condition.yml
111
+ - bin/service_books.rb
100
112
  - bin/test.rb
101
113
  - config_one_condition.yml
102
114
  - config_three_conditions.yml