Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Add FetchData msg-att methods and update rdoc #220

Merged
merged 1 commit into from
Nov 10, 2023

Conversation

nevans
Copy link
Collaborator

@nevans nevans commented Nov 8, 2023

An accessor method has been created for every supported msg-att in #attr. These attr accessors also provide a place for documentation for each of the supported message attributes.

With one exception, all of the methods return the value from #attr, unchanged. The exception is #internaldate, which uses parse_time to return a Time object rather than a string.

With one exception, these methods are given the same name as their msg-att with "." changed to "_". The exception is the "body section" attributes ("BODY[#{section_spec}]<#offset}>"), which have been given several methods (which all accept an offset keyword argument):

  • #message for BODY[]
  • #part(1, 2, 3) for BODY[1.2.3]
  • #text(1, 2, 3) for BODY[1.2.3.TEXT]
  • #mime(1, 2, 3) for BODY[1.2.3.MIME]
  • #header(1, 2, 3) for BODY[1.2.3.HEADER]
  • #header(fields: %w[Foo Bar]) or #header_fields("Foo", "Bar")
    for BODY[HEADER.FIELDS (Foo Bar)]
  • #header(except: %w[Foo Bar]) or #header_fields_not("Foo", "Bar")
    for BODY[HEADER.FIELDS.NOT (Foo Bar)]

@nevans nevans force-pushed the fetch_data-attr-methods branch 7 times, most recently from 406c9e9 to afcf01c Compare November 10, 2023 02:50
An accessor method has been created for every supported `msg-att` in
`#attrs`.  These attrs accessors also provide a place for documentation
for each of the supported message attributes.

With one exception, all of the methods return the value from `#attrs`,
unchanged.  The exception is `#internaldate`, which uses `parse_time` to
return a `Time` object rather than a string.

With one exception, these methods are given the same name as their
`msg-att` with "." changed to "_".  The exception is the "body section"
attributes (`"BODY[#{section_spec}]<#offset}>"`), which has been given
several methods (which all accept an `offset` keyword argument):

* `#message`         for `BODY[]`
* `#part(1, 2, 3)`   for `BODY[1.2.3]`
* `#text(1, 2, 3)`   for `BODY[1.2.3.TEXT]`
* `#mime(1, 2, 3)`   for `BODY[1.2.3.MIME]`
* `#header(1, 2, 3)` for `BODY[1.2.3.HEADER]`
* `#header(fields: %w[Foo Bar])` or `#header_fields("Foo", "Bar")`
  for `BODY[HEADER.FIELDS (Foo Bar)]`
* `#header(except: %w[Foo Bar])` or `#header_fields_not("Foo", "Bar")`
  for `BODY[HEADER.FIELDS.NOT (Foo Bar)]`
@nevans nevans force-pushed the fetch_data-attr-methods branch from afcf01c to 5afd51a Compare November 10, 2023 02:51
@nevans nevans merged commit 5511dd6 into ruby:master Nov 10, 2023
11 checks passed
@nevans nevans deleted the fetch_data-attr-methods branch November 10, 2023 02:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant