@@ -174,7 +174,7 @@ class IMAP
174
174
#
175
175
# <i>Set membership:</i>
176
176
# - #include? (aliased as #member?):
177
- # Returns whether a given object (nz-number, range, or <tt>*</tt>) is
177
+ # Returns whether a given element (nz-number, range, or <tt>*</tt>) is
178
178
# contained by the set.
179
179
# - #include_star?: Returns whether the set contains <tt>*</tt>.
180
180
#
@@ -258,8 +258,8 @@ class IMAP
258
258
#
259
259
# These methods always update #string to be fully sorted and coalesced.
260
260
#
261
- # - #add (aliased as #<<): Adds a given object to the set; returns +self+.
262
- # - #add?: If the given object is not an element in the set, adds it and
261
+ # - #add (aliased as #<<): Adds a given element to the set; returns +self+.
262
+ # - #add?: If the given element is not fully included the set, adds it and
263
263
# returns +self+; otherwise, returns +nil+.
264
264
# - #merge: Merges multiple elements into the set; returns +self+.
265
265
# - #complement!: Replaces the contents of the set with its own #complement.
@@ -268,7 +268,7 @@ class IMAP
268
268
#
269
269
# These methods _may_ cause #string to not be sorted or coalesced.
270
270
#
271
- # - #append: Adds a given object to the set, appending it to the existing
271
+ # - #append: Adds the given entry to the set, appending it to the existing
272
272
# string, and returns +self+.
273
273
# - #string=: Assigns a new #string value and replaces #elements to match.
274
274
# - #replace: Replaces the contents of the set with the contents
@@ -279,8 +279,8 @@ class IMAP
279
279
# sorted and coalesced.
280
280
#
281
281
# - #clear: Removes all elements in the set; returns +self+.
282
- # - #delete: Removes a given object from the set; returns +self+.
283
- # - #delete?: If the given object is an element in the set, removes it and
282
+ # - #delete: Removes a given element from the set; returns +self+.
283
+ # - #delete?: If the given element is included in the set, removes it and
284
284
# returns it; otherwise, returns +nil+.
285
285
# - #delete_at: Removes the number at a given offset.
286
286
# - #slice!: Removes the number or consecutive numbers at a given offset or
@@ -690,16 +690,16 @@ def ~; remain_frozen dup.complement! end
690
690
alias complement :~
691
691
692
692
# :call-seq:
693
- # add(object ) -> self
693
+ # add(element ) -> self
694
694
# self << other -> self
695
695
#
696
696
# Adds a range or number to the set and returns +self+.
697
697
#
698
698
# #string will be regenerated. Use #merge to add many elements at once.
699
699
#
700
700
# Related: #add?, #merge, #union
701
- def add ( object )
702
- tuple_add input_to_tuple object
701
+ def add ( element )
702
+ tuple_add input_to_tuple element
703
703
normalize!
704
704
end
705
705
alias << add
@@ -708,38 +708,38 @@ def add(object)
708
708
#
709
709
# Unlike #add, #merge, or #union, the new value is appended to #string.
710
710
# This may result in a #string which has duplicates or is out-of-order.
711
- def append ( object )
711
+ def append ( entry )
712
712
modifying!
713
- tuple = input_to_tuple object
713
+ tuple = input_to_tuple entry
714
714
entry = tuple_to_str tuple
715
715
string unless empty? # write @string before tuple_add
716
716
tuple_add tuple
717
717
@string = -( @string ? "#{ @string } ,#{ entry } " : entry )
718
718
self
719
719
end
720
720
721
- # :call-seq: add?(object ) -> self or nil
721
+ # :call-seq: add?(element ) -> self or nil
722
722
#
723
723
# Adds a range or number to the set and returns +self+. Returns +nil+
724
- # when the object is already included in the set.
724
+ # when the element is already included in the set.
725
725
#
726
726
# #string will be regenerated. Use #merge to add many elements at once.
727
727
#
728
728
# Related: #add, #merge, #union, #include?
729
- def add? ( object )
730
- add object unless include? object
729
+ def add? ( element )
730
+ add element unless include? element
731
731
end
732
732
733
- # :call-seq: delete(object ) -> self
733
+ # :call-seq: delete(element ) -> self
734
734
#
735
735
# Deletes the given range or number from the set and returns +self+.
736
736
#
737
737
# #string will be regenerated after deletion. Use #subtract to remove
738
738
# many elements at once.
739
739
#
740
740
# Related: #delete?, #delete_at, #subtract, #difference
741
- def delete ( object )
742
- tuple_subtract input_to_tuple object
741
+ def delete ( element )
742
+ tuple_subtract input_to_tuple element
743
743
normalize!
744
744
end
745
745
@@ -775,8 +775,8 @@ def delete(object)
775
775
# #string will be regenerated after deletion.
776
776
#
777
777
# Related: #delete, #delete_at, #subtract, #difference, #disjoint?
778
- def delete? ( object )
779
- tuple = input_to_tuple object
778
+ def delete? ( element )
779
+ tuple = input_to_tuple element
780
780
if tuple . first == tuple . last
781
781
return unless include_tuple? tuple
782
782
tuple_subtract tuple
@@ -1386,14 +1386,14 @@ def initialize_dup(other)
1386
1386
super
1387
1387
end
1388
1388
1389
- def input_to_tuple ( obj )
1390
- obj = input_try_convert obj
1391
- case obj
1392
- when *STARS , Integer then [ int = to_tuple_int ( obj ) , int ]
1393
- when Range then range_to_tuple ( obj )
1394
- when String then str_to_tuple ( obj )
1389
+ def input_to_tuple ( entry )
1390
+ entry = input_try_convert entry
1391
+ case entry
1392
+ when *STARS , Integer then [ int = to_tuple_int ( entry ) , int ]
1393
+ when Range then range_to_tuple ( entry )
1394
+ when String then str_to_tuple ( entry )
1395
1395
else
1396
- raise DataFormatError , "expected number or range, got %p" % [ obj ]
1396
+ raise DataFormatError , "expected number or range, got %p" % [ entry ]
1397
1397
end
1398
1398
end
1399
1399
0 commit comments