Class: LucidIntercom::RenderSnippet
- Inherits:
-
Object
- Object
- LucidIntercom::RenderSnippet
- Defined in:
- lib/lucid_intercom/render_snippet.rb
Constant Summary collapse
- TEMPLATE =
ERB.new(File.read("#{__dir__}/snippet.html.erb")).freeze
Instance Attribute Summary collapse
Instance Method Summary collapse
-
#call ⇒ String
The rendered HTML.
-
#initialize(shop_attributes = {}, app_attributes = {}, credentials = LucidIntercom.credentials) ⇒ RenderSnippet
constructor
Leave arguments unset for unauthenticated visitors.
Constructor Details
#initialize(shop_attributes = {}, app_attributes = {}, credentials = LucidIntercom.credentials) ⇒ RenderSnippet
Leave arguments unset for unauthenticated visitors.
18 19 20 21 |
# File 'lib/lucid_intercom/render_snippet.rb', line 18 def initialize(shop_attributes = {}, app_attributes = {}, credentials = LucidIntercom.credentials) @credentials = credentials @attributes = Attributes.new(shop_attributes, app_attributes, credentials) if shop_attributes.empty? end |
Instance Attribute Details
#attributes ⇒ LucidIntercom::Attributes (readonly)
24 25 26 |
# File 'lib/lucid_intercom/render_snippet.rb', line 24 def attributes @attributes end |
#credentials ⇒ LucidIntercom::Credentials (readonly)
26 27 28 |
# File 'lib/lucid_intercom/render_snippet.rb', line 26 def credentials @credentials end |
Instance Method Details
#call ⇒ String
Returns the rendered HTML.
31 32 33 |
# File 'lib/lucid_intercom/render_snippet.rb', line 31 def call TEMPLATE.result(binding) end |