Class: SparkleFormation::AuditLog::Record
- Inherits:
-
Object
- Object
- SparkleFormation::AuditLog::Record
- Defined in:
- lib/sparkle_formation/audit_log.rb
Instance Attribute Summary collapse
- #audit_log ⇒ AuditLog readonly
-
#caller ⇒ SourcePoint
readonly
Path and line of caller.
-
#location ⇒ SourcePoint
readonly
Path and line of location.
-
#name ⇒ String
readonly
Name of record.
-
#type ⇒ Symbol
readonly
Type of record.
Instance Method Summary collapse
-
#initialize(*args) ⇒ Record
constructor
A new instance of Record.
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_log ⇒ AuditLog (readonly)
32 33 34 |
# File 'lib/sparkle_formation/audit_log.rb', line 32 def audit_log @audit_log end |
#caller ⇒ SourcePoint (readonly)
Returns path and line of caller
40 41 42 |
# File 'lib/sparkle_formation/audit_log.rb', line 40 def caller @caller end |
#location ⇒ SourcePoint (readonly)
Returns path and line of location
34 35 36 |
# File 'lib/sparkle_formation/audit_log.rb', line 34 def location @location end |
#name ⇒ String (readonly)
Returns name of record
36 37 38 |
# File 'lib/sparkle_formation/audit_log.rb', line 36 def name @name end |
#type ⇒ Symbol (readonly)
Returns type of record
38 39 40 |
# File 'lib/sparkle_formation/audit_log.rb', line 38 def type @type end |