Sha256: d1f04f02f7e1d8cf4d85f2528a120939b5ef657732834a06fddb8c295de44a9b

Contents?: true

Size: 610 Bytes

Versions: 12

Compression:

Stored size: 610 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
      return name == attr.name && alias_name == attr.alias_name if attr.is_a? Panko::Attribute
      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

12 entries across 12 versions & 1 rubygems

Version Path
panko_serializer-0.5.10 lib/panko/attribute.rb
panko_serializer-0.5.9 lib/panko/attribute.rb
panko_serializer-0.5.8 lib/panko/attribute.rb
panko_serializer-0.5.7 lib/panko/attribute.rb
panko_serializer-0.5.6 lib/panko/attribute.rb
panko_serializer-0.5.5 lib/panko/attribute.rb
panko_serializer-0.5.4 lib/panko/attribute.rb
panko_serializer-0.5.3 lib/panko/attribute.rb
panko_serializer-0.5.2 lib/panko/attribute.rb
panko_serializer-0.5.1 lib/panko/attribute.rb
panko_serializer-0.5.0 lib/panko/attribute.rb
panko_serializer-0.4.4 lib/panko/attribute.rb