Sha256: 595f876813147df68c0abd4085a04fa781a28ea4ae7cc589e6832695093d890e

Contents?: true

Size: 810 Bytes

Versions: 7

Compression:

Stored size: 810 Bytes

Contents

module Lionel
  class ProxyAction
    extend Forwardable

    attr_reader :action
    def_delegators :action, :data, :type, :date

    def initialize(action)
      @action = action
    end

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

    def create?
      type == "createCard"
    end

    def update?
      type == "updateCard"
    end

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

    def list_after
      data_attributes("listAfter")
    end

    def list_before
      data_attributes("listBefore")
    end

    def list_after?
      list_after.any?
    end

    def list_before?
      list_before.any?
    end

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

  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
lionel_richie-0.3.1 lib/lionel/proxy_action.rb
lionel_richie-0.3.0 lib/lionel/proxy_action.rb
lionel_richie-0.2.4 lib/lionel/proxy_action.rb
lionel_richie-0.2.3.1 lib/lionel/proxy_action.rb
lionel_richie-0.2.3 lib/lionel/proxy_action.rb
lionel_richie-0.2.1 lib/lionel/proxy_action.rb
lionel_richie-0.2.0 lib/lionel/proxy_action.rb