Class: AskAwesomely::Embeddable
- Inherits:
-
Object
- Object
- AskAwesomely::Embeddable
- Defined in:
- lib/ask_awesomely/embeddable.rb
Constant Summary collapse
- EMBED_TYPES =
%i( modal drawer widget fullscreen )
- DEFAULT_OPTIONS =
{ width: 800, height: 600, button_text: "Launch me!" }
Instance Method Summary collapse
-
#initialize(embed_type) ⇒ Embeddable
constructor
A new instance of Embeddable.
- #render(typeform, options = {}) ⇒ Object
Constructor Details
#initialize(embed_type) ⇒ Embeddable
Returns a new instance of Embeddable.
17 18 19 20 21 22 23 |
# File 'lib/ask_awesomely/embeddable.rb', line 17 def initialize() unless EMBED_TYPES.include?() raise AskAwesomely::EmbedTypeError, "embed type must be one of: #{EMBED_TYPES.join(', ')}" end @embed_type = end |
Instance Method Details
#render(typeform, options = {}) ⇒ Object
25 26 27 28 29 30 |
# File 'lib/ask_awesomely/embeddable.rb', line 25 def render(typeform, = {}) locals = DEFAULT_OPTIONS .merge() .merge(public_url: typeform.public_url, title: typeform.title) Erubis::Eruby.new(template).result(locals) end |