Class: Noticent::Channel

Inherits:
Object
  • Object
show all
Defined in:
lib/noticent/channel.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config, recipients, payload, configuration) ⇒ Channel

Returns a new instance of Channel.



10
11
12
13
14
15
16
17
# File 'lib/noticent/channel.rb', line 10

def initialize(config, recipients, payload, configuration)
  @config = config
  @recipients = recipients
  @payload = payload
  @configuration = configuration
  @current_user = payload.current_user if payload.respond_to? :current_user
  @routes = Rails.application.routes.url_helpers
end

Instance Attribute Details

#dataObject

Returns the value of attribute data.



8
9
10
# File 'lib/noticent/channel.rb', line 8

def data
  @data
end

Instance Method Details

#render_within_context(template:, content:, context:) ⇒ Object



19
20
21
22
# File 'lib/noticent/channel.rb', line 19

def render_within_context(template:, content:, context:)
  @content = ERB.new(content).result(context)
  template.nil? ? @content : ERB.new(template).result(binding)
end