Sha256: 9e911dbfeb1d5d52eeefaa5d1ff22a6c56aaad394cac64ed72617e7fae71c11b

Contents?: true

Size: 590 Bytes

Versions: 5

Compression:

Stored size: 590 Bytes

Contents

module Troles::Common
  module Marshaller
    class Generic
      attr_reader :role_subject, :valid_roles

      def initialize role_subject
        raise "The roles subject is not valid: #{role_subject}" if !role_subject || !role_subject.respond_to?(:has_role?)
        @role_subject = role_subject
        @valid_roles = role_subject.class.valid_roles
      end
      
      protected

      def ds_field_value  
        role_subject.send ds_field_name
      end      

      def ds_field_name  
        @ds_field_name ||= role_subject.class.role_field
      end      
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
troles-0.6.1 lib/troles/common/marshaller/generic.rb
troles-0.6.0 lib/troles/common/marshaller/generic.rb
troles-0.5.2 lib/troles/common/marshaller/generic.rb
troles-0.5.1 lib/troles/common/marshaller/generic.rb
troles-0.5.0 lib/troles/common/marshaller/generic.rb