Field cleanup and performance improvements #488

Merged
merged 4 commits into from Jan 23, 2013

Projects

None yet

2 participants

@bpot
Contributor
bpot commented Dec 31, 2012

No description provided.

@jeremy jeremy commented on the diff Jan 23, 2013
lib/mail/field.rb
@@ -195,16 +199,11 @@ def create_field(name, value, charset)
def new_field(name, value, charset)
lower_case_name = name.to_s.downcase
- header_name = nil
- FIELDS_MAP.each do |field_name, _|
- header_name = field_name if lower_case_name == field_name
- end
- if header_name
- FIELDS_MAP[header_name].new(value, charset)
+ if field_klass = FIELDS_MAP[lower_case_name]
@jeremy
jeremy Jan 23, 2013 Collaborator

Looks like this should be using FIELD_ORDER_LOOKUP - ?

@jeremy
jeremy Jan 23, 2013 Collaborator

Nevermind, wrong mapping!

@jeremy
Collaborator
jeremy commented Jan 23, 2013

These all look good. Only change is if anyone tweaks FIELD_ORDER, existing memoized field order won't change. Seems reasonable & non-breaking.

@jeremy jeremy merged commit 2433698 into mikel:master Jan 23, 2013
@jeremy jeremy added a commit that referenced this pull request Jan 23, 2013
@jeremy jeremy Update CHANGELOG for #488 4836faf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment