Sha256: 89bc8efac52973a171acc6285f15808f8b7e39dfbdc5e8ebc5c0b2f7fb2b7802

Contents?: true

Size: 560 Bytes

Versions: 2

Compression:

Stored size: 560 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 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

2 entries across 2 versions & 1 rubygems

Version Path
norikra-0.0.16-java lib/norikra/target.rb
norikra-0.0.15-java lib/norikra/target.rb