Class: SparkleFormation::AuditLog::Record

Inherits:
Object
  • Object
show all
Defined in:
lib/sparkle_formation/audit_log.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Record

Returns a new instance of Record



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/sparkle_formation/audit_log.rb', line 42

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]

  [[@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

Instance Attribute Details

#audit_logAuditLog (readonly)

Returns:



32
33
34
# File 'lib/sparkle_formation/audit_log.rb', line 32

def audit_log
  @audit_log
end

#callerSourcePoint (readonly)

Returns path and line of caller

Returns:



40
41
42
# File 'lib/sparkle_formation/audit_log.rb', line 40

def caller
  @caller
end

#locationSourcePoint (readonly)

Returns path and line of location

Returns:



34
35
36
# File 'lib/sparkle_formation/audit_log.rb', line 34

def location
  @location
end

#nameString (readonly)

Returns name of record

Returns:

  • (String)

    name of record



36
37
38
# File 'lib/sparkle_formation/audit_log.rb', line 36

def name
  @name
end

#typeSymbol (readonly)

Returns type of record

Returns:

  • (Symbol)

    type of record



38
39
40
# File 'lib/sparkle_formation/audit_log.rb', line 38

def type
  @type
end