Sha256: 94d5bc70e5f6616ae02655c60d19a5aed3d3ca46ae5f0510c3592bb96a64d9ae

Contents?: true

Size: 1.06 KB

Versions: 32

Compression:

Stored size: 1.06 KB

Contents

format do
  # turn off autodetection of uri's
  def chunk_list
    :references
  end
end

# format :html do
#   def pointer_items args
#     card.item_names(context: :raw).map do |iname|
#       wrap_item iname, args
#     end
#   end
# end#

format :email_text do
  def email_addresses context
    context ||= self
    card.item_names(context: context.name).map do |name|
      # FIXME: context is processed twice here because pointers absolutize
      # item_names by default while other types can return relative names.
      # That's poor default behavior and should be fixed!
      name = name.to_name.absolute context
      email_address?(name) ? name : email_address_from_card(name, context)
    end.flatten.compact.join(", ")
  end

  def email_address? string
    string =~ /.+\@.+\..+/
  end

  def email_address_from_card name, context
    card = Card.fetch name
    card.account&.email || email_addresses_from_card_content(card, context)
  end

  def email_addresses_from_card_content card, context
    subformat(card).contextual_content(context).split(/[,\n]/)
  end
end

Version data entries

32 entries across 32 versions & 2 rubygems

Version Path
card-mod-email-0.11.4 set/abstract/email_field.rb
card-mod-email-0.11.3 set/abstract/email_field.rb
card-mod-email-0.11.2 set/abstract/email_field.rb
card-mod-email-0.11.1 set/abstract/email_field.rb
card-mod-email-0.11.0 set/abstract/email_field.rb
card-1.100.0 mod/email/set/abstract/email_field.rb
card-1.99.6 mod/email/set/abstract/email_field.rb
card-1.99.5 mod/email/set/abstract/email_field.rb
card-1.99.4 mod/email/set/abstract/email_field.rb
card-1.99.3 mod/email/set/abstract/email_field.rb
card-1.99.2 mod/email/set/abstract/email_field.rb
card-1.99.1 mod/email/set/abstract/email_field.rb
card-1.99.0 mod/email/set/abstract/email_field.rb
card-1.98.3 mod/email/set/abstract/email_field.rb
card-1.98.2 mod/email/set/abstract/email_field.rb
card-1.98.1 mod/email/set/abstract/email_field.rb
card-1.98.0 mod/email/set/abstract/email_field.rb
card-1.97.0.1 mod/email/set/abstract/email_field.rb
card-1.97.0 mod/email/set/abstract/email_field.rb
card-1.96.8 mod/email/set/abstract/email_field.rb