Module: RulesEngine::Publish

Defined in:
lib/rules_engine/publish/publisher.rb,
lib/rules_engine/publish/publisher/db_publisher.rb

Defined Under Namespace

Classes: DbPublisher, Publisher, RePublishedPlan

Class Method Summary collapse

Class Method Details

.publisherObject



20
21
22
23
# File 'lib/rules_engine/publish/publisher.rb', line 20

def publisher
  throw "RulesEngine::Publish::Publisher required" unless @publisher
  @publisher
end

.publisher=(publisher_options) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/rules_engine/publish/publisher.rb', line 7

def publisher=(publisher_options)
  type, *parameters = *([ publisher_options ].flatten)

  case type
  when Symbol
    publisher_class_name = type.to_s.camelize
    publisher_class = RulesEngine::Publish.const_get(publisher_class_name)
    @publisher = publisher_class.new(*parameters)
  else
    @publisher = publisher_options
  end
end