Class: Decidim::ContentParsers::ProposalParser

Inherits:
ResourceParser
  • Object
show all
Defined in:
lib/decidim/content_parsers/proposal_parser.rb

Overview

A parser that searches mentions of Proposals in content.

This parser accepts two ways for linking Proposals.

  • Using a standard url starting with http or https.

  • With a word starting with ‘~` and digits afterwards will be considered a possible mentioned proposal.

For example ‘~1234`, but no `~ 1234`.

Also fills a ‘Metadata#linked_proposals` attribute.

See Also:

  • Examples of how to use a content parser

Defined Under Namespace

Classes: Metadata

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(content, context) ⇒ ProposalParser

Returns a new instance of ProposalParser.



22
23
24
25
# File 'lib/decidim/content_parsers/proposal_parser.rb', line 22

def initialize(content, context)
  super
  @metadata = Metadata.new([])
end

Instance Attribute Details

#metadataObject (readonly)

Returns the value of attribute metadata.



28
29
30
# File 'lib/decidim/content_parsers/proposal_parser.rb', line 28

def 
  @metadata
end