Module: Card::Action::Differ

Included in:
Card::Action
Defined in:
mod/history/lib/card/action/differ.rb

Overview

a collection of methods for comparing actions

Instance Method Summary collapse

Instance Method Details

#cardtype_diff(opts = {}) ⇒ rendered diff

compare action's cardtype value with previous cardtype value

Returns:

  • (rendered diff)


14
15
16
17
# File 'mod/history/lib/card/action/differ.rb', line 14

def cardtype_diff opts={}
  return unless new_type?
  diff_object(:cardtype, opts).complete
end

#content_diff(diff_type = :expanded, opts = nil) ⇒ rendered diff

compare action's content value with previous content value

Returns:

  • (rendered diff)


21
22
23
24
25
# File 'mod/history/lib/card/action/differ.rb', line 21

def content_diff diff_type=:expanded, opts=nil
  return unless new_content?
  dobj = content_diff_object(opts)
  diff_type == :summary ? dobj.summary : dobj.complete
end

#green?true/false

test whether content was visibly added

Returns:

  • (true/false)


35
36
37
# File 'mod/history/lib/card/action/differ.rb', line 35

def green?
  content_diff_object.green?
end

#name_diff(opts = {}) ⇒ rendered diff

compare action's name value with previous name value

Returns:

  • (rendered diff)


7
8
9
10
# File 'mod/history/lib/card/action/differ.rb', line 7

def name_diff opts={}
  return unless new_name?
  diff_object(:name, opts).complete
end

#raw_view(content = nil) ⇒ Object



39
40
41
42
43
44
45
# File 'mod/history/lib/card/action/differ.rb', line 39

def raw_view content=nil
  original_content = card.db_content
  card.db_content = content || value(:db_content)
  card.format.render_raw
ensure
  card.db_content = original_content
end

#red?true/false

test whether content was visibly removed

Returns:

  • (true/false)


29
30
31
# File 'mod/history/lib/card/action/differ.rb', line 29

def red?
  content_diff_object.red?
end

#summary_diff_omits_content?Boolean

Returns:

  • (Boolean)


47
48
49
# File 'mod/history/lib/card/action/differ.rb', line 47

def summary_diff_omits_content?
  content_diff_object.summary_omits_content?
end