Sha256: 1e899d7d6e27f2312cb4fa8118c03dca3ac2563e4f1e04453494bfd67e850399

Contents?: true

Size: 619 Bytes

Versions: 12

Compression:

Stored size: 619 Bytes

Contents

module Norikra
  class Target
    attr_accessor :name, :fields, :auto_field

    def self.valid?(target_name)
      target_name =~ /^[a-zA-Z]([_a-zA-Z0-9]*[a-zA-Z0-9])?$/
    end

    def initialize(name, fields=[], auto_field=true)
      @name = name
      @fields = fields
      @auto_field = !!auto_field
    end

    def <=>(other)
      self.name <=> other.name
    end

    def to_hash
      {:name => @name, :auto_field => @auto_field}
    end

    def ==(other)
      self.class == other.class ? self.name == other.name : self.name == other.to_s
    end

    def auto_field?
      @auto_field
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
norikra-0.1.3-java lib/norikra/target.rb
norikra-0.1.2-java lib/norikra/target.rb
norikra-0.1.1-java lib/norikra/target.rb
norikra-0.1.0-java lib/norikra/target.rb
norikra-0.0.24-java lib/norikra/target.rb
norikra-0.0.23-java lib/norikra/target.rb
norikra-0.0.22-java lib/norikra/target.rb
norikra-0.0.21-java lib/norikra/target.rb
norikra-0.0.20-java lib/norikra/target.rb
norikra-0.0.19-java lib/norikra/target.rb
norikra-0.0.18-java lib/norikra/target.rb
norikra-0.0.17-java lib/norikra/target.rb