Class: PuppetX::Puppetlabs::Migration::OverviewModel::Location

Inherits:
Entity
  • Object
show all
Defined in:
lib/puppet_x/puppetlabs/migration/overview_model.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Entity

#<=>, #eql?, from_hash, #hash, #id, init_relationships, many_relationship, #many_relationship, simple_name

Methods included from ModelObject

#initialize_from_hash, #to_hash

Constructor Details

#initialize(id, file_id, line, pos) ⇒ Location

Returns a new instance of Location.



263
264
265
266
267
268
# File 'lib/puppet_x/puppetlabs/migration/overview_model.rb', line 263

def initialize(id, file_id, line, pos)
  super(id)
  @file_id = file_id
  @line = line
  @pos = pos
end

Instance Attribute Details

#file_idObject (readonly)



259
260
261
# File 'lib/puppet_x/puppetlabs/migration/overview_model.rb', line 259

def file_id
  @file_id
end

#lineObject (readonly)



260
261
262
# File 'lib/puppet_x/puppetlabs/migration/overview_model.rb', line 260

def line
  @line
end

#posObject (readonly)



261
262
263
# File 'lib/puppet_x/puppetlabs/migration/overview_model.rb', line 261

def pos
  @pos
end

Class Method Details

.many_rels_hashObject



274
275
276
277
278
279
280
# File 'lib/puppet_x/puppetlabs/migration/overview_model.rb', line 274

def self.many_rels_hash
  {
    :resources => ResourceIssue.instance_method(:location_id),
    :preview_resources => ResourceConflict.instance_method(:preview_location_id),
    :log_entries => LogEntry.instance_method(:location_id)
  }
end

Instance Method Details

#lp_stringObject



282
283
284
285
286
287
288
289
290
# File 'lib/puppet_x/puppetlabs/migration/overview_model.rb', line 282

def lp_string
  if @line.nil?
    '--'
  elsif @pos.nil?
    @line.to_s
  else
    "#{@line}:#{@pos}"
  end
end

#one_relationship(name) ⇒ Object



270
271
272
# File 'lib/puppet_x/puppetlabs/migration/overview_model.rb', line 270

def one_relationship(name)
  file_id || UNDEFINED_ID if name == :file
end