Module: Parliament::Grom::Decorator::WebArticle

Defined in:
lib/parliament/grom/decorator/web_article.rb

Overview

Decorator namespace for Grom::Node instances with type: id.parliament.uk/schema/ConstituencyArea

Since:

  • 0.1.0

Instance Method Summary collapse

Instance Method Details

#article_bodyString

Alias body with fallback.

Returns:

  • (String, String)

    the body of the Grom::Node or an empty string.

Since:

  • 0.1.0



23
24
25
# File 'lib/parliament/grom/decorator/web_article.rb', line 23

def article_body
  respond_to?(:body) ? body : ''
end

#article_summaryString

Alias summary with fallback.

Returns:

  • (String, String)

    the summary of the Grom::Node or an empty string.

Since:

  • 0.1.0



16
17
18
# File 'lib/parliament/grom/decorator/web_article.rb', line 16

def article_summary
  respond_to?(:summary) ? summary : ''
end

#article_titleString

Alias title with fallback.

Returns:

  • (String, String)

    the title of the Grom::Node or an empty string.

Since:

  • 0.1.0



9
10
11
# File 'lib/parliament/grom/decorator/web_article.rb', line 9

def article_title
  respond_to?(:title) ? title : ''
end

#audiencesArray

Alias audience with fallback.

Returns:

  • (Array, Array)

    array of collection Grom::Node or an empty array.

Since:

  • 0.1.0



44
45
46
# File 'lib/parliament/grom/decorator/web_article.rb', line 44

def audiences
  respond_to?(:audience) ? audience : []
end

#collectionsArray

Alias articleHasCollection with fallback.

Returns:

  • (Array, Array)

    array of collection Grom::Node or an empty array.

Since:

  • 0.1.0



30
31
32
# File 'lib/parliament/grom/decorator/web_article.rb', line 30

def collections
  respond_to?(:articleHasCollection) ? articleHasCollection : []
end

#publishersArray

Alias publisher with fallback.

Returns:

  • (Array, Array)

    array of collection Grom::Node or an empty array.

Since:

  • 0.1.0



58
59
60
# File 'lib/parliament/grom/decorator/web_article.rb', line 58

def publishers
  respond_to?(:publisher) ? topic : []
end

Alias relatedArticle with fallback.

Returns:

  • (Array, Array)

    array of article Grom::Nodes or an empty array.

Since:

  • 0.1.0



65
66
67
# File 'lib/parliament/grom/decorator/web_article.rb', line 65

def related_articles
  respond_to?(:relatedArticle) ? relatedArticle : []
end

#topicsArray

Alias topic with fallback.

Returns:

  • (Array, Array)

    array of collection Grom::Node or an empty array.

Since:

  • 0.1.0



51
52
53
# File 'lib/parliament/grom/decorator/web_article.rb', line 51

def topics
  respond_to?(:topic) ? topic : []
end

#typesArray

Alias articleType with fallback.

Returns:

  • (Array, Array)

    array of collection Grom::Node or an empty array.

Since:

  • 0.1.0



37
38
39
# File 'lib/parliament/grom/decorator/web_article.rb', line 37

def types
  respond_to?(:articleType) ? articleType : []
end