Module: Riddler

Defined in:
lib/riddler.rb,
lib/riddler/step.rb,
lib/riddler/context.rb,
lib/riddler/element.rb,
lib/riddler/version.rb,
lib/riddler/includeable.rb,
lib/riddler/configuration.rb,
lib/riddler/elements/copy.rb,
lib/riddler/elements/link.rb,
lib/riddler/elements/text.rb,
lib/riddler/steps/content.rb,
lib/riddler/steps/variant.rb,
lib/riddler/elements/image.rb,
lib/riddler/test_generator.rb,
lib/riddler/context_builder.rb,
lib/riddler/drops/hash_drop.rb,
lib/riddler/context_director.rb,
lib/riddler/elements/heading.rb,
lib/riddler/elements/variant.rb,
lib/riddler/protobuf/slug_pb.rb,
lib/riddler/use_cases/show_slug.rb,
lib/riddler/use_cases/preview_step.rb,
lib/riddler/use_cases/preview_context.rb,
lib/riddler/use_cases/admin_preview_step.rb,
lib/riddler/use_cases/dismiss_interaction.rb,
lib/riddler/protobuf/content_definition_pb.rb,
lib/riddler/protobuf/content_management_pb.rb,
lib/riddler/use_cases/complete_interaction.rb,
lib/riddler/context_builders/faraday_builder.rb,
lib/riddler/use_cases/show_content_definition.rb,
lib/riddler/protobuf/content_management_services_pb.rb,
lib/riddler/context_builders/user_agent.rb

Defined Under Namespace

Modules: ContextBuilders, Drops, Elements, Includeable, Protobuf, Steps, UseCases Classes: Configuration, Context, ContextBuilder, ContextDirector, Element, Error, Step, TestGenerator

Constant Summary collapse

VERSION =
"0.2.0"

Class Method Summary collapse

Class Method Details

.configObject



45
# File 'lib/riddler.rb', line 45

def self.config; configuration; end

.configurationObject



41
42
43
# File 'lib/riddler.rb', line 41

def self.configuration
  @configuration ||= ::Riddler::Configuration.new
end

.configure {|configuration| ... } ⇒ Object

Yields:



37
38
39
# File 'lib/riddler.rb', line 37

def self.configure
  yield configuration
end

.loggerObject



47
48
49
# File 'lib/riddler.rb', line 47

def self.logger
  @logger ||= ::Outlog.logger
end

.render(content_definition, context = {}) ⇒ Object



51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/riddler.rb', line 51

def self.render content_definition, context={}
  unless context.kind_of? ::Riddler::Context
    director = ::Riddler::ContextDirector.new context
    context = director.context
  end

  case content_definition["content_type"]
  when "element"
    content = ::Riddler::Element.for content_definition, context
  when "step"
    content = ::Riddler::Step.for content_definition, context
  end

  return nil unless content.include?

  content.to_hash
end