class SparkleFormation::AuditLog::Record

Attributes

audit_log[R]

@return [AuditLog]

caller[R]

@return [SourcePoint] path and line of caller

compile_duration[RW]

@return [Float] compile duration

location[R]

@return [SourcePoint] path and line of location

name[R]

@return [String] name of record

type[R]

@return [Symbol] type of record

Public Class Methods

new(*args) click to toggle source
# File lib/sparkle_formation/audit_log.rb, line 44
def initialize(*args)
  if args.last.is_a?(Hash)
    opts = args.pop.to_smash
  else
    opts = Smash.new
  end
  @name, @type, @location, @caller = args
  @caller = opts[:caller] if opts[:caller]
  @name = opts[:name] if opts[:name]
  @type = opts[:type] if opts[:type]
  @location = opts[:location] if opts[:location]
  @compile_duration = opts[:compile_duration].to_f

  [[@name, :name], [@location, :location], [@type, :type], [@caller, :caller]].each do |v, n|
    raise ArgumentError, "Missing required argument `#{n}`" unless v
  end

  @audit_log = AuditLog.new
  @caller = SourcePoint.new(*@caller)
  @location = SourcePoint.new(*@location)
  @type = @type.to_sym
end