Sha256: b54a84aa726610ef425d2671a96203013bab4efc8930996d4af20e8352cb445a

Contents?: true

Size: 384 Bytes

Versions: 2

Compression:

Stored size: 384 Bytes

Contents

require 'triad'
require 'surrounded/context_errors'
module Surrounded
  module Context
    class RoleMap < Triad
      def role?(role)
        keys.include?(role)
      end

      def role_player?(object)
        !values(object).empty?
      rescue ::Triad::ItemNotPresent
        false
      end

      def assigned_player(role)
        values(role).first
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
surrounded-0.9.1 lib/surrounded/context/role_map.rb
surrounded-0.9.0 lib/surrounded/context/role_map.rb