Sha256: eb39f9cf8168a22f5a64cbe2c1e91b0cf650239c01df1fca655a626e8d33a93c

Contents?: true

Size: 628 Bytes

Versions: 10

Compression:

Stored size: 628 Bytes

Contents

# frozen_string_literal: true

module Panko
  class Attribute
    def self.create(name, alias_name: nil)
      alias_name = alias_name.to_s unless alias_name.nil?
      Attribute.new(name.to_s, alias_name)
    end

    def ==(attr)
      return name.to_sym == attr if attr.is_a? Symbol
      if attr.is_a? Panko::Attribute
        return name == attr.name && alias_name == attr.alias_name
      end
      super
    end

    def hash
      name.to_sym.hash
    end

    def eql?(attr)
      self.==(attr)
    end

    def inspect
      "<Panko::Attribute name=#{name.inspect} alias_name=#{alias_name.inspect}>"
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
panko_serializer-0.4.3 lib/panko/attribute.rb
panko_serializer-0.4.2 lib/panko/attribute.rb
panko_serializer-0.4.0 lib/panko/attribute.rb
panko_serializer-0.3.9 lib/panko/attribute.rb
panko_serializer-0.3.7 lib/panko/attribute.rb
panko_serializer-0.3.6 lib/panko/attribute.rb
panko_serializer-0.3.5 lib/panko/attribute.rb
panko_serializer-0.3.4 lib/panko/attribute.rb
panko_serializer-0.3.3 lib/panko/attribute.rb
panko_serializer-0.3.2 lib/panko/attribute.rb