Class: ActiveHistory::Action

Inherits:
Object
  • Object
show all
Defined in:
lib/activehistory/action.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attrs) ⇒ Action

Returns a new instance of Action.



5
6
7
8
9
# File 'lib/activehistory/action.rb', line 5

def initialize(attrs)
  attrs.each do |k,v|
    self.send("#{k}=", v)
  end
end

Instance Attribute Details

#diffObject

Returns the value of attribute diff.



3
4
5
# File 'lib/activehistory/action.rb', line 3

def diff
  @diff
end

#subjectObject

Returns the value of attribute subject.



3
4
5
# File 'lib/activehistory/action.rb', line 3

def subject
  @subject
end

#timestampObject

Returns the value of attribute timestamp.



3
4
5
# File 'lib/activehistory/action.rb', line 3

def timestamp
  @timestamp
end

#typeObject

Returns the value of attribute type.



3
4
5
# File 'lib/activehistory/action.rb', line 3

def type
  @type
end

Instance Method Details

#as_jsonObject



11
12
13
14
15
16
17
18
# File 'lib/activehistory/action.rb', line 11

def as_json
  {
    diff: diff.as_json,
    subject:   @subject,
    timestamp:    @timestamp.iso8601(3),
    type:         @type
  }
end