Sha256: 3fbc2a2fe32c663ab3dc235eb8a6399a6fc2f69c08e98e863ed82ddf7884f623

Contents?: true

Size: 765 Bytes

Versions: 5

Compression:

Stored size: 765 Bytes

Contents

module Ixtlan
  module Models
    class Role

      include DataMapper::Resource
      
      def self.default_storage_name
        "Role"
      end

      property :name, String, :nullable => false , :format => /^[a-zA-Z0-9\-_.]*$/, :length => 32, :key => true

      def hash
        attribute_get(:name).hash
      end

      alias :eql? :==
      def ==(other)
        attribute_get(:name).eql?(other.attribute_get(:name))
      end

      if protected_instance_methods.find {|m| m == 'to_x'}.nil?
       
        protected
        
        alias :to_x :to_xml_document
        def to_xml_document(opts, doc = nil)
          opts.merge!({:exclude => [:permission_resource,:permission_action]})
          to_x(opts, doc)
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ixtlan-0.2.4 lib/ixtlan/models/role.rb
ixtlan-0.2.3 lib/ixtlan/models/role.rb
ixtlan-0.2.2 lib/ixtlan/models/role.rb
ixtlan-0.2.1 lib/ixtlan/models/role.rb
ixtlan-0.2.0 lib/ixtlan/models/role.rb