Class: Riddler::UseCases::ShowContentDefinition

Inherits:
Object
  • Object
show all
Defined in:
lib/riddler/use_cases/show_content_definition.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(content_definition_repo:, content_definition_id:, context_director:) ⇒ ShowContentDefinition

Returns a new instance of ShowContentDefinition.



8
9
10
11
12
13
14
15
# File 'lib/riddler/use_cases/show_content_definition.rb', line 8

def initialize content_definition_repo:, content_definition_id:, context_director:
  @content_definition_repo = content_definition_repo
  @content_definition_id = content_definition_id
  @context_director = context_director

  @content_definition = lookup_content_definition
  @step = ::Riddler::Step.for content_definition.definition, context
end

Instance Attribute Details

#content_definitionObject (readonly)

Returns the value of attribute content_definition.



4
5
6
# File 'lib/riddler/use_cases/show_content_definition.rb', line 4

def content_definition
  @content_definition
end

#content_definition_idObject (readonly)

Returns the value of attribute content_definition_id.



4
5
6
# File 'lib/riddler/use_cases/show_content_definition.rb', line 4

def content_definition_id
  @content_definition_id
end

#content_definition_repoObject (readonly)

Returns the value of attribute content_definition_repo.



4
5
6
# File 'lib/riddler/use_cases/show_content_definition.rb', line 4

def content_definition_repo
  @content_definition_repo
end

#context_directorObject (readonly)

Returns the value of attribute context_director.



4
5
6
# File 'lib/riddler/use_cases/show_content_definition.rb', line 4

def context_director
  @context_director
end

#stepObject (readonly)

Returns the value of attribute step.



4
5
6
# File 'lib/riddler/use_cases/show_content_definition.rb', line 4

def step
  @step
end

Instance Method Details

#contextObject



17
18
19
# File 'lib/riddler/use_cases/show_content_definition.rb', line 17

def context
  context_director.context
end

#excluded?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/riddler/use_cases/show_content_definition.rb', line 25

def excluded?
  !step.include?
end

#processObject



21
22
23
# File 'lib/riddler/use_cases/show_content_definition.rb', line 21

def process
  step.to_hash
end