Class: Jekyll::ActionNetwork::Action
- Inherits:
-
Object
- Object
- Jekyll::ActionNetwork::Action
- Defined in:
- lib/jekyll/action-network/action.rb
Overview
An action network action, call the doc method to get a Jekyll::Document for this action
Instance Method Summary collapse
- #blindpost ⇒ Object
- #content ⇒ Object
- #doc ⇒ Object
- #endpoint ⇒ Object
- #front_matter ⇒ Object
-
#initialize(site, name, collection, config, action, settings) ⇒ Action
constructor
A new instance of Action.
- #path ⇒ Object
- #slug ⇒ Object
Constructor Details
#initialize(site, name, collection, config, action, settings) ⇒ Action
Returns a new instance of Action.
9 10 11 12 13 14 15 16 17 |
# File 'lib/jekyll/action-network/action.rb', line 9 def initialize(site, name, collection, config, action, settings) @site = site @collection = collection @config = config @action = action @name = name @settings = settings @utils = Jekyll::ActionNetwork::Utils.new end |
Instance Method Details
#blindpost ⇒ Object
56 57 58 59 |
# File 'lib/jekyll/action-network/action.rb', line 56 def blindpost linked_type = @settings['endpoint_mappings'][@name] return @action['_links']["osdi:#{linked_type}"]['href'] if linked_type end |
#content ⇒ Object
61 62 63 |
# File 'lib/jekyll/action-network/action.rb', line 61 def content @content ||= @action[@config["content"]] end |
#doc ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'lib/jekyll/action-network/action.rb', line 19 def doc return @doc if @doc @doc = Jekyll::Document.new(path, collection: @collection, site: @site) @doc.content = content @doc.merge_data!(front_matter) @doc end |
#endpoint ⇒ Object
52 53 54 |
# File 'lib/jekyll/action-network/action.rb', line 52 def endpoint @action['_links']['self']['href'] end |
#front_matter ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/jekyll/action-network/action.rb', line 36 def front_matter return @front_matter if @front_matter @front_matter = {} @config["mappings"].each do |a, d| front_matter[d] = @action[a] end @front_matter["layout"] = @config["layout"] @front_matter["slug"] = slug @front_matter["embed_code"] = @utils.(@action["browser_url"]) @front_matter["action_type"] = @name @front_matter["action_network_endpoint"] = endpoint @front_matter["action_network_blindpost"] = blindpost @front_matter end |
#path ⇒ Object
32 33 34 |
# File 'lib/jekyll/action-network/action.rb', line 32 def path @path ||= File.join(@site.source, "_#{@config["collection"]}", "#{slug}.md") end |
#slug ⇒ Object
28 29 30 |
# File 'lib/jekyll/action-network/action.rb', line 28 def slug @slug ||= @action["browser_url"].split("/")[-1] if @action["browser_url"] end |