Class: JobInvocationComposer::HostIdsTranslator

Inherits:
Object
  • Object
show all
Defined in:
app/models/job_invocation_composer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(input) ⇒ HostIdsTranslator

Returns a new instance of HostIdsTranslator.



289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
# File 'app/models/job_invocation_composer.rb', line 289

def initialize(input)
  case input
  when Bookmark
    @bookmark = input
  when Host::Base
    @hosts = [input]
  when Array
    @hosts = input.map do |id|
      Host::Managed.authorized.friendly.find(id)
    end
  when String
    @scoped_search = input
  else
    @hosts = input
  end

  @scoped_search ||= Targeting.build_query_from_hosts(hosts.map(&:id)) if @hosts
end

Instance Attribute Details

#bookmarkObject (readonly)

Returns the value of attribute bookmark.



287
288
289
# File 'app/models/job_invocation_composer.rb', line 287

def bookmark
  @bookmark
end

#host_idsObject (readonly)

Returns the value of attribute host_ids.



287
288
289
# File 'app/models/job_invocation_composer.rb', line 287

def host_ids
  @host_ids
end

#hostsObject (readonly)

Returns the value of attribute hosts.



287
288
289
# File 'app/models/job_invocation_composer.rb', line 287

def hosts
  @hosts
end

#scoped_searchObject (readonly)

Returns the value of attribute scoped_search.



287
288
289
# File 'app/models/job_invocation_composer.rb', line 287

def scoped_search
  @scoped_search
end