Skip to content

Commit 779f356

Browse files
committed
📚 Consistently use "element" or "entry" vs "object"
1 parent 7d67c66 commit 779f356

File tree

1 file changed

+27
-27
lines changed

1 file changed

+27
-27
lines changed

lib/net/imap/sequence_set.rb

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ class IMAP
174174
#
175175
# <i>Set membership:</i>
176176
# - #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
178178
# contained by the set.
179179
# - #include_star?: Returns whether the set contains <tt>*</tt>.
180180
#
@@ -258,8 +258,8 @@ class IMAP
258258
#
259259
# These methods always update #string to be fully sorted and coalesced.
260260
#
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
263263
# returns +self+; otherwise, returns +nil+.
264264
# - #merge: Merges multiple elements into the set; returns +self+.
265265
# - #complement!: Replaces the contents of the set with its own #complement.
@@ -268,7 +268,7 @@ class IMAP
268268
#
269269
# These methods _may_ cause #string to not be sorted or coalesced.
270270
#
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
272272
# string, and returns +self+.
273273
# - #string=: Assigns a new #string value and replaces #elements to match.
274274
# - #replace: Replaces the contents of the set with the contents
@@ -279,8 +279,8 @@ class IMAP
279279
# sorted and coalesced.
280280
#
281281
# - #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
284284
# returns it; otherwise, returns +nil+.
285285
# - #delete_at: Removes the number at a given offset.
286286
# - #slice!: Removes the number or consecutive numbers at a given offset or
@@ -690,16 +690,16 @@ def ~; remain_frozen dup.complement! end
690690
alias complement :~
691691

692692
# :call-seq:
693-
# add(object) -> self
693+
# add(element) -> self
694694
# self << other -> self
695695
#
696696
# Adds a range or number to the set and returns +self+.
697697
#
698698
# #string will be regenerated. Use #merge to add many elements at once.
699699
#
700700
# 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
703703
normalize!
704704
end
705705
alias << add
@@ -708,38 +708,38 @@ def add(object)
708708
#
709709
# Unlike #add, #merge, or #union, the new value is appended to #string.
710710
# This may result in a #string which has duplicates or is out-of-order.
711-
def append(object)
711+
def append(entry)
712712
modifying!
713-
tuple = input_to_tuple object
713+
tuple = input_to_tuple entry
714714
entry = tuple_to_str tuple
715715
string unless empty? # write @string before tuple_add
716716
tuple_add tuple
717717
@string = -(@string ? "#{@string},#{entry}" : entry)
718718
self
719719
end
720720

721-
# :call-seq: add?(object) -> self or nil
721+
# :call-seq: add?(element) -> self or nil
722722
#
723723
# 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.
725725
#
726726
# #string will be regenerated. Use #merge to add many elements at once.
727727
#
728728
# 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
731731
end
732732

733-
# :call-seq: delete(object) -> self
733+
# :call-seq: delete(element) -> self
734734
#
735735
# Deletes the given range or number from the set and returns +self+.
736736
#
737737
# #string will be regenerated after deletion. Use #subtract to remove
738738
# many elements at once.
739739
#
740740
# 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
743743
normalize!
744744
end
745745

@@ -775,8 +775,8 @@ def delete(object)
775775
# #string will be regenerated after deletion.
776776
#
777777
# 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
780780
if tuple.first == tuple.last
781781
return unless include_tuple? tuple
782782
tuple_subtract tuple
@@ -1386,14 +1386,14 @@ def initialize_dup(other)
13861386
super
13871387
end
13881388

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)
13951395
else
1396-
raise DataFormatError, "expected number or range, got %p" % [obj]
1396+
raise DataFormatError, "expected number or range, got %p" % [entry]
13971397
end
13981398
end
13991399

0 commit comments

Comments
 (0)