Module: TMail::Metas
- Defined in:
- lib/tmail_metas.rb
Constant Summary collapse
- @@meta_tag_scanner =
Looks for href="&something=value">key=value} pairs within the mail’s body by default
/\s*\{\{\s*(.*)\s*\}\}\s*/m- @@meta_scanner_options =
- group_seperator
-
what break each key,value pair
- seperator
-
what breaks keys and values apart
{ :group_seperator => '&', :seperator => '=' }
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.scanner=(scanner) ⇒ Object
11 |
# File 'lib/tmail_metas.rb', line 11 def self.scanner=(scanner); @@meta_tag_scanner = scanner end |
.scanner_options=(options) ⇒ Object
12 |
# File 'lib/tmail_metas.rb', line 12 def self.(); @@meta_scanner_options = end |
Instance Method Details
#metas ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/tmail_metas.rb', line 13 def @metas ||= Hash[*$1.split(@@meta_scanner_options[:group_seperator]).map do |group| group.split(@@meta_scanner_options[:seperator]).map(&:strip) end.flatten] if body =~ @@meta_tag_scanner self.body = body.gsub(@@meta_tag_scanner, '') @metas end |