Sha256: a6f656c37506746f844130b521a94a4312be2c64228848383268fd9467621035

Contents?: true

Size: 782 Bytes

Versions: 2

Compression:

Stored size: 782 Bytes

Contents

module Rod
  module Rest
    class PropertyMetadata
      attr_reader :name, :symbolic_name

      # Creates new property metadata using the +name+ and +options+.
      def initialize(name, options)
        raise ArgumentError.new("nil name") if name.nil?
        @name = name.to_s
        @symbolic_name = @name.to_sym
        @index = options[:index]
      end

      # Returns true if the property is indexed.
      def indexed?
        !! @index
      end

      # Detailed description of the porperty, i.e.
      # Rod::Rest::PropertyMetadata<name>
      def inspect
        indexed = indexed? ? ",indexed" : ""
        "Property<#{@name}#{indexed}>"
      end

      # Short description of the poperty.
      def to_s
        "'#{@name}' property"
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rod-rest-0.5.2 lib/rod/rest/property_metadata.rb
rod-rest-0.5.1 lib/rod/rest/property_metadata.rb