Sha256: f2641097c1b063e756f993950b4cf4525a49769c04da267a9eb55980f17f29c4
Contents?: true
Size: 713 Bytes
Versions: 9
Compression:
Stored size: 713 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
9 entries across 9 versions & 1 rubygems