double_linked_list 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ea08489c7b0cdb6bec170f49dba3857db90c946e
4
- data.tar.gz: ce028edb83320cf4ce3e6c3702f45b8134f73386
3
+ metadata.gz: '09299281dc5a6ae2528a842346c6cdd44155511b'
4
+ data.tar.gz: eab934adfa9f7f7fc1515355daa62f381fc8f538
5
5
  SHA512:
6
- metadata.gz: 7e62df4f0714f54faad2e00bedd4c44399edabc7a995a10dbe1f9878431311b28438425acb25d9175c61b42a8616baca58e226d7bbab19494b8a82b8f40da098
7
- data.tar.gz: 542ce5843c55faf00ffdfa37b776c1fb5fa7567128286c4ed857c532d486148b1b74715b2e3dd9dbb34e0ad04402aeca3f8b765952faccba414138b6765af00f
6
+ metadata.gz: ca6141327f7c1df6477f876d6f76785476094cb32f93b3bcd0538923aa949fb35999623484b4d7b948c99769c58f5ffc7186c4794ba24e681d9b7b4e4ec74a27
7
+ data.tar.gz: 1dfb1aa2d152cb3e06d61d9580960048c970af785aa52d954cf26dba5c4011d3e0c8f2587dd12b6786da5e44de1320dda6900036545847ca1c5c98a44ed68ac8
data/README.md CHANGED
@@ -80,7 +80,7 @@ users = [
80
80
  User.new(3)
81
81
  ]
82
82
  llist = DoubleLinkedList.from_a(users)
83
- llist.find_by{ |elem| elem.datum.id == 1 }.datum.id #=> 1
83
+ llist.find_by{ |elem| elem.id == 1 }.id #=> 1
84
84
  ```
85
85
 
86
86
  __append:__
@@ -130,8 +130,8 @@ The first element of the splitted array are the elememts that return true in the
130
130
  ```ruby
131
131
  llist = DoubleLinkedList.from_a(1, 2, 3, 4)
132
132
  chunked = llist.chunk_by do |e, current_llist|
133
- e.datum == 3 && current_llist.head.datum == 1
134
- end
133
+ e.datum == 3 && current_llist.head.datum == 1
134
+ end
135
135
  chunked.first.is_a? DoubleLinkedList #=> true
136
136
  chunked.first.head.datum #=> 1
137
137
  chunked.first.last.datum #=> 2
@@ -144,10 +144,10 @@ A custom dll can be provided to enhance dll outputs
144
144
  class CustomDLL < DoubleLinkedList; end
145
145
 
146
146
  llist = DoubleLinkedList.from_a(1, 2, 3, 4)
147
- chunked = llist.chunk_by do |e, current_llist|
148
- e.datum == 3 && current_llist.head.datum == 1
149
- end
150
- chunked.first.is_a? CustomDLL #=> true
147
+ chunked = llist.chunk_by(CustomDLL) do |e, current_llist|
148
+ e.datum == 3 && current_llist.head.datum == 1
149
+ end
150
+ chunked.first.is_a?(CustomDLL) #=> true
151
151
  ```
152
152
 
153
153
  __select_by:__
@@ -158,10 +158,10 @@ In the block must be returned a `DoubleLinkedList::Sequence` instance and head a
158
158
  ```ruby
159
159
  llist = DoubleLinkedList.from_a(1, 2, 3, 4)
160
160
  select = llist.select_by do |e|
161
- if e.datum == 2 && e.next.datum == 3
162
- DoubleLinkedList::Sequence.new(head: e, last: e.next)
163
- end
164
- end
161
+ if e.datum == 2 && e.next.datum == 3
162
+ DoubleLinkedList::Sequence.new(head: e, last: e.next)
163
+ end
164
+ end
165
165
  select.is_a? Array #=> true
166
166
  select.first.is_a? DoubleLinkedList #=> true
167
167
  select.map{|ll| ll.to_a } #=> [[2, 3]]
@@ -169,7 +169,7 @@ select.map{|ll| ll.to_a } #=> [[2, 3]]
169
169
 
170
170
  ## Development
171
171
 
172
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake false ---` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
172
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `bundle exec rspec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
173
173
 
174
174
  To install this gem onto your local machine, run `bundle exec rake install`. [rubygems.org](https://rubygems.org).
175
175
 
@@ -104,11 +104,7 @@ class DoubleLinkedList
104
104
  end
105
105
 
106
106
  def method_missing(method, *args, &block)
107
- if datum.respond_to?(method)
108
- datum.send(method, *args, &block)
109
- else
110
- super
111
- end
107
+ datum.send(method, *args, &block)
112
108
  end
113
109
 
114
110
  def respond_to_missing?(method_name, include_private = false)
@@ -1,3 +1,3 @@
1
1
  class DoubleLinkedList
2
- VERSION = "0.4.0"
2
+ VERSION = "0.4.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: double_linked_list
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Artur Pañach
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-11-02 00:00:00.000000000 Z
11
+ date: 2017-11-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler