Class: Txbr::ConnectedContentTag

Inherits:
Liquid::Tag
  • Object
show all
Defined in:
lib/txbr.rb

Constant Summary collapse

PREFIX_RE =

This is a regular expression to pull out the variable in which to store the value returned from the call made by the connected_content filter. For example, if connected_content makes a request to foo.com and is told to store the results in a variable called “strings”, the API response will then be accessible via the normal Liquid variable mechanism, i.e. {…}. Say the API at foo.com returned something like “bar”:“baz”, then the template might contain Txbr::ConnectedContentTag.{strings{strings.bar}, which would print out “baz”.

/:save\s+(#{Liquid::Lexer::IDENTIFIER})/

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(tag_name, arg) ⇒ ConnectedContentTag

Returns a new instance of ConnectedContentTag.



74
75
76
77
# File 'lib/txbr.rb', line 74

def initialize(tag_name, arg, *)
  @tag_name = tag_name
  @prefix = arg.match(PREFIX_RE).captures.first
end

Instance Attribute Details

#prefixObject (readonly)

Returns the value of attribute prefix.



72
73
74
# File 'lib/txbr.rb', line 72

def prefix
  @prefix
end

#tag_nameObject (readonly)

Returns the value of attribute tag_name.



72
73
74
# File 'lib/txbr.rb', line 72

def tag_name
  @tag_name
end