Sha256: b19e86421f84ef90a850333e19a3c112c23618e813f0ca33115b781d3376da74

Contents?: true

Size: 719 Bytes

Versions: 16

Compression:

Stored size: 719 Bytes

Contents

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

    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
      @last_modified = nil
    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

    def update!
      @last_modified = Time.now
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
norikra-1.1.2-java lib/norikra/target.rb
norikra-1.1.1-java lib/norikra/target.rb
norikra-1.1.0-java lib/norikra/target.rb
norikra-1.0.8-java lib/norikra/target.rb
norikra-1.0.7-java lib/norikra/target.rb
norikra-1.0.6-java lib/norikra/target.rb
norikra-1.0.5-java lib/norikra/target.rb
norikra-1.0.4-java lib/norikra/target.rb
norikra-1.0.3-java lib/norikra/target.rb
norikra-1.0.2-java lib/norikra/target.rb
norikra-1.0.1-java lib/norikra/target.rb
norikra-1.0.0-java lib/norikra/target.rb
norikra-0.1.7-java lib/norikra/target.rb
norikra-0.1.6-java lib/norikra/target.rb
norikra-0.1.5-java lib/norikra/target.rb
norikra-0.1.4-java lib/norikra/target.rb