Sha256: 5cb490577f68349f1755010e76ffca6f00b597fe5587733975f19e10ffcf490d

Contents?: true

Size: 385 Bytes

Versions: 18

Compression:

Stored size: 385 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::ValueNotPresent
        false
      end

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

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
surrounded-0.8.4 lib/surrounded/context/role_map.rb
surrounded-0.8.3 lib/surrounded/context/role_map.rb
surrounded-0.8.2 lib/surrounded/context/role_map.rb
surrounded-0.8.1 lib/surrounded/context/role_map.rb
surrounded-0.8.0 lib/surrounded/context/role_map.rb
surrounded-0.7.3 lib/surrounded/context/role_map.rb
surrounded-0.7.2 lib/surrounded/context/role_map.rb
surrounded-0.7.1 lib/surrounded/context/role_map.rb
surrounded-0.7.0 lib/surrounded/context/role_map.rb
surrounded-0.6.0 lib/surrounded/context/role_map.rb
surrounded-0.5.1 lib/surrounded/context/role_map.rb
surrounded-0.5.0 lib/surrounded/context/role_map.rb
surrounded-0.4.1 lib/surrounded/context/role_map.rb
surrounded-0.4.0 lib/surrounded/context/role_map.rb
surrounded-0.3.1 lib/surrounded/context/role_map.rb
surrounded-0.3.0 lib/surrounded/context/role_map.rb
surrounded-0.2.1 lib/surrounded/context/role_map.rb
surrounded-0.2.0 lib/surrounded/context/role_map.rb