Class: Phronomy::Agent::DerivedContentSpec

Inherits:
Data
  • Object
show all
Defined in:
lib/phronomy/agent/derived_content_spec.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**values) ⇒ DerivedContentSpec

Returns a new instance of DerivedContentSpec.



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/phronomy/agent/derived_content_spec.rb', line 17

def initialize(**values)
  super(**values.merge(
    content: Immutable.copy(values[:content]),
    content_format: values.fetch(:content_format).to_sym,
    category: values.fetch(:category).to_sym,
    role: values[:role]&.to_sym,
    coverage_candidate_ids: Array(values[:coverage_candidate_ids]).map(&:to_s).freeze,
    source_record_ids: Array(values[:source_record_ids]).map(&:to_s).freeze,
    source_content_refs: Array(values[:source_content_refs]).map(&:to_s).freeze,
    transformer_id: values.fetch(:transformer_id).to_s.freeze,
    transformer_version: Integer(values.fetch(:transformer_version)),
    metadata: Immutable.copy(values[:metadata] || {})
  ))
  freeze
end

Instance Attribute Details

#categoryObject (readonly)

Returns the value of attribute category

Returns:

  • (Object)

    the current value of category



5
6
7
# File 'lib/phronomy/agent/derived_content_spec.rb', line 5

def category
  @category
end

#contentObject (readonly)

Returns the value of attribute content

Returns:

  • (Object)

    the current value of content



5
6
7
# File 'lib/phronomy/agent/derived_content_spec.rb', line 5

def content
  @content
end

#content_formatObject (readonly)

Returns the value of attribute content_format

Returns:

  • (Object)

    the current value of content_format



5
6
7
# File 'lib/phronomy/agent/derived_content_spec.rb', line 5

def content_format
  @content_format
end

#coverage_candidate_idsObject (readonly)

Returns the value of attribute coverage_candidate_ids

Returns:

  • (Object)

    the current value of coverage_candidate_ids



5
6
7
# File 'lib/phronomy/agent/derived_content_spec.rb', line 5

def coverage_candidate_ids
  @coverage_candidate_ids
end

#metadataObject (readonly)

Returns the value of attribute metadata

Returns:

  • (Object)

    the current value of metadata



5
6
7
# File 'lib/phronomy/agent/derived_content_spec.rb', line 5

def 
  @metadata
end

#roleObject (readonly)

Returns the value of attribute role

Returns:

  • (Object)

    the current value of role



5
6
7
# File 'lib/phronomy/agent/derived_content_spec.rb', line 5

def role
  @role
end

#source_content_refsObject (readonly)

Returns the value of attribute source_content_refs

Returns:

  • (Object)

    the current value of source_content_refs



5
6
7
# File 'lib/phronomy/agent/derived_content_spec.rb', line 5

def source_content_refs
  @source_content_refs
end

#source_record_idsObject (readonly)

Returns the value of attribute source_record_ids

Returns:

  • (Object)

    the current value of source_record_ids



5
6
7
# File 'lib/phronomy/agent/derived_content_spec.rb', line 5

def source_record_ids
  @source_record_ids
end

#transformer_idObject (readonly)

Returns the value of attribute transformer_id

Returns:

  • (Object)

    the current value of transformer_id



5
6
7
# File 'lib/phronomy/agent/derived_content_spec.rb', line 5

def transformer_id
  @transformer_id
end

#transformer_versionObject (readonly)

Returns the value of attribute transformer_version

Returns:

  • (Object)

    the current value of transformer_version



5
6
7
# File 'lib/phronomy/agent/derived_content_spec.rb', line 5

def transformer_version
  @transformer_version
end