Class: Lionel::ProxyAction

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/lionel/proxy_action.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(action) ⇒ ProxyAction

Returns a new instance of ProxyAction.



8
9
10
# File 'lib/lionel/proxy_action.rb', line 8

def initialize(action)
  @action = action
end

Instance Attribute Details

#actionObject (readonly)

Returns the value of attribute action.



5
6
7
# File 'lib/lionel/proxy_action.rb', line 5

def action
  @action
end

Instance Method Details

#board_idObject



24
25
26
# File 'lib/lionel/proxy_action.rb', line 24

def board_id
  data_attributes("board")["id"]
end

#create?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/lionel/proxy_action.rb', line 16

def create?
  type == "createCard"
end

#data_attributes(key) ⇒ Object



12
13
14
# File 'lib/lionel/proxy_action.rb', line 12

def data_attributes(key)
  data[key] || {}
end

#list_afterObject



28
29
30
# File 'lib/lionel/proxy_action.rb', line 28

def list_after
  data_attributes("listAfter")
end

#list_after?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/lionel/proxy_action.rb', line 36

def list_after?
  list_after.any?
end

#list_beforeObject



32
33
34
# File 'lib/lionel/proxy_action.rb', line 32

def list_before
  data_attributes("listBefore")
end

#list_before?Boolean

Returns:

  • (Boolean)


40
41
42
# File 'lib/lionel/proxy_action.rb', line 40

def list_before?
  list_before.any?
end

#moved_to?(list_name) ⇒ Boolean

Returns:

  • (Boolean)


44
45
46
47
# File 'lib/lionel/proxy_action.rb', line 44

def moved_to?(list_name)
  return false unless list_after?
  !!(list_after["name"] =~ %r{^#{Regexp.escape(list_name.downcase)}}i)
end

#update?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/lionel/proxy_action.rb', line 20

def update?
  type == "updateCard"
end