Sha256: 906c324886a3791e3cfb817d68141bbbe14f13be791ec96d8d52130f40dc445a
Contents?: true
Size: 1.27 KB
Versions: 2
Compression:
Stored size: 1.27 KB
Contents
module AIXM # @abstract class Feature include AIXM::Concerns::HashEquality REGION_RE = /\A[A-Z]{2}\z/.freeze private_class_method :new # Freely usable e.g. to find_by foreign keys. # # @return [Object] attr_accessor :meta # Reference to source of the feature data. # # @overload source # @return [String] # @overload source=(value) # @param value [String] attr_reader :source # OFMX region all features in this document belong to. # # @overload region # @return [String] # @overload region=(value) # @param value [String] attr_reader :region def initialize(source: nil, region: nil) self.source = source self.region = region || AIXM.config.region end def source=(value) fail(ArgumentError, "invalid source") unless value.nil? || value.is_a?(String) @source = value end def region=(value) fail(ArgumentError, "invalid region") unless value.nil? || (value.is_a?(String) && value.upcase.match?(REGION_RE)) @region = value&.upcase end # @see Object#== def ==(other) self.__class__ === other && self.to_uid == other.to_uid end # @see Object#eql? def hash [self.__class__, to_uid].hash end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
aixm-1.2.1 | lib/aixm/feature.rb |
aixm-1.2.0 | lib/aixm/feature.rb |