Class: Content::ContentViewFactory

Inherits:
Object
  • Object
show all
Extended by:
ActiveModel::Naming
Includes:
ActiveModel::Conversion, ActiveModel::Validations
Defined in:
app/services/content/content_view_factory.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ ContentViewFactory

Returns a new instance of ContentViewFactory.



10
11
12
13
14
# File 'app/services/content/content_view_factory.rb', line 10

def initialize(attributes = {})
  attributes.each do |name, value|
    instance_variable_set("@#{name}", value) if respond_to?("#{name}".to_sym)
  end
end

Instance Attribute Details

#originator_idObject

Returns the value of attribute originator_id.



7
8
9
# File 'app/services/content/content_view_factory.rb', line 7

def originator_id
  @originator_id
end

#originator_typeObject

Returns the value of attribute originator_type.



7
8
9
# File 'app/services/content/content_view_factory.rb', line 7

def originator_type
  @originator_type
end

#os_cvObject

Returns the value of attribute os_cv.



7
8
9
# File 'app/services/content/content_view_factory.rb', line 7

def os_cv
  @os_cv
end

#parent_cvObject

Returns the value of attribute parent_cv.



7
8
9
# File 'app/services/content/content_view_factory.rb', line 7

def parent_cv
  @parent_cv
end

#product_cvObject

Returns the value of attribute product_cv.



7
8
9
# File 'app/services/content/content_view_factory.rb', line 7

def product_cv
  @product_cv
end

#source_repositoriesObject

Returns the value of attribute source_repositories.



7
8
9
# File 'app/services/content/content_view_factory.rb', line 7

def source_repositories
  @source_repositories
end

Instance Method Details

#content_viewObject



20
21
22
23
24
25
26
27
# File 'app/services/content/content_view_factory.rb', line 20

def content_view
  case originator_type
    when 'Hostgroup'
      create_composite_content_view
    else
      ContentView.new(:repository_ids_to_clone => originator.repositories, :originator => originator)
  end
end

#persisted?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'app/services/content/content_view_factory.rb', line 16

def persisted?
  false
end

#repositoriesObject



29
30
31
# File 'app/services/content/content_view_factory.rb', line 29

def repositories
  originator.repositories
end