net-imap 0.6.0 → 0.6.2

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
  SHA256:
3
- metadata.gz: 561e6151a9540c8eaa6c12fd16d625061843a053fb0b0c8a2f215eb1a518ef70
4
- data.tar.gz: 5be61c15097d2e0007822fc6c4825f59795d6078d6cf9b5cbe6ed4dd2bd1d22e
3
+ metadata.gz: bc6f6d65e2f5092b38316ed4d381551838dd412a5b376c06359225e8f53a020c
4
+ data.tar.gz: d5daf47c70a868650687f7db3d1a1e074555a634708c16792e19f1cb53f8cc83
5
5
  SHA512:
6
- metadata.gz: f84a8adf89f177e953fe57e390b027232bc4c7325ecb0049221a88db87fccc76a09281aea87c4f48de05bc547db1248b628b9c271134a466aedba953305001cc
7
- data.tar.gz: 0b82898fb8581bab9a30c5b3edb96c89d81c4bddf197ade29a25ef166db827983a6c2c25d1eda9989a9f985cfcbec52f4bf484dbc1b57cfde32f432dcd0dfbc3
6
+ metadata.gz: 1aeb682e73a666591079aac75c4325f22079dfbf61dbe71df135059b9087890633c31fd036e61757a217f1b1ff3e1d3771801a7ec6f3817646a0f8d2c0896386
7
+ data.tar.gz: 8cd118d9943b83010dd2f4916ab7641e120743991d3bc06062c4eb286098d1af8af05d86854b3e44235a0b3263b801db1cf9a7d64ac3140d89eda1aca086e6cd
@@ -788,7 +788,11 @@ module Net
788
788
  # Related: #min, #minmax, #slice
789
789
  def max(count = nil, star: :*)
790
790
  if count
791
- slice(-[count, size].min..) || remain_frozen_empty
791
+ if cardinality <= count
792
+ frozen? ? self : dup
793
+ else
794
+ slice(-count..) || remain_frozen_empty
795
+ end
792
796
  elsif (val = max_num)
793
797
  val == STAR_INT ? star : val
794
798
  end
@@ -1094,8 +1098,9 @@ module Net
1094
1098
  # Related: #delete, #delete_at, #subtract, #difference, #disjoint?
1095
1099
  def delete?(element)
1096
1100
  modifying! # short-circuit before import_minmax
1101
+ element = input_try_convert(element)
1097
1102
  minmax = import_minmax element
1098
- if minmax.first == minmax.last
1103
+ if number_input?(element)
1099
1104
  return unless include_minmax? minmax
1100
1105
  subtract_minmax minmax
1101
1106
  normalize!
@@ -1913,6 +1918,14 @@ module Net
1913
1918
  input
1914
1919
  end
1915
1920
 
1921
+ # NOTE: input_try_convert must be called on input first
1922
+ def number_input?(input)
1923
+ case input
1924
+ when *STARS, Integer then true
1925
+ when String then !input.include?(/[:,]/)
1926
+ end
1927
+ end
1928
+
1916
1929
  def import_range_minmax(range)
1917
1930
  first = import_num(range.begin || 1)
1918
1931
  last = import_num(range.end || :*)
data/lib/net/imap.rb CHANGED
@@ -788,7 +788,7 @@ module Net
788
788
  # * {IMAP URLAUTH Authorization Mechanism Registry}[https://www.iana.org/assignments/urlauth-authorization-mechanism-registry/urlauth-authorization-mechanism-registry.xhtml]
789
789
  #
790
790
  class IMAP < Protocol
791
- VERSION = "0.6.0"
791
+ VERSION = "0.6.2"
792
792
 
793
793
  # Aliases for supported capabilities, to be used with the #enable command.
794
794
  ENABLE_ALIASES = {
@@ -3230,7 +3230,7 @@ module Net
3230
3230
  warn(RESPONSES_DEPRECATION_MSG, uplevel: 1, category: :deprecated)
3231
3231
  when :frozen_dup
3232
3232
  synchronize {
3233
- responses = @responses.transform_values(&:freeze)
3233
+ responses = @responses.transform_values { _1.dup.freeze }
3234
3234
  responses.default_proc = nil
3235
3235
  responses.default = [].freeze
3236
3236
  return responses.freeze
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: net-imap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shugo Maeda
@@ -129,7 +129,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
129
129
  - !ruby/object:Gem::Version
130
130
  version: '0'
131
131
  requirements: []
132
- rubygems_version: 4.0.1
132
+ rubygems_version: 4.0.2
133
133
  specification_version: 4
134
134
  summary: Ruby client api for Internet Message Access Protocol
135
135
  test_files: []