Class: Locomotive::Steam::Liquid::Tags::GoogleAnalytics
- Inherits:
-
Liquid::Tag
- Object
- Liquid::Tag
- Locomotive::Steam::Liquid::Tags::GoogleAnalytics
- Defined in:
- lib/locomotive/steam/liquid/tags/google_analytics.rb
Constant Summary collapse
- Syntax =
/(#{::Liquid::QuotedFragment}+)/o.freeze
Instance Attribute Summary collapse
-
#account_id ⇒ Object
readonly
Returns the value of attribute account_id.
Instance Method Summary collapse
-
#initialize(tag_name, markup, options) ⇒ GoogleAnalytics
constructor
A new instance of GoogleAnalytics.
- #render(context) ⇒ Object
Constructor Details
#initialize(tag_name, markup, options) ⇒ GoogleAnalytics
Returns a new instance of GoogleAnalytics.
11 12 13 14 15 16 17 18 19 |
# File 'lib/locomotive/steam/liquid/tags/google_analytics.rb', line 11 def initialize(tag_name, markup, ) super if markup =~ Syntax @account_id = ::Liquid::Expression.parse($1) else raise ::Liquid::SyntaxError.new("Syntax Error in 'google_analytics' - Valid syntax: google_analytics <account_id>") end end |
Instance Attribute Details
#account_id ⇒ Object (readonly)
Returns the value of attribute account_id.
9 10 11 |
# File 'lib/locomotive/steam/liquid/tags/google_analytics.rb', line 9 def account_id @account_id end |
Instance Method Details
#render(context) ⇒ Object
21 22 23 |
# File 'lib/locomotive/steam/liquid/tags/google_analytics.rb', line 21 def render(context) ga_snippet(context.evaluate(account_id)) end |