Sha256: c05b737f3f053c0374689e6cf26b9d4dda5d45e34fcf048e077906ca88254a05
Contents?: true
Size: 1.45 KB
Versions: 107
Compression:
Stored size: 1.45 KB
Contents
module OrigenTesters module IGXLBasedTester class Base class PatsetPattern ALIASES = { pattern: :file_name } def self.define # Generate accessors for all attributes and their aliases self::PATSET_ATTRS.each do |attr| writer = "#{attr}=".to_sym reader = attr.to_sym attr_reader attr.to_sym unless method_defined? reader attr_writer attr.to_sym unless method_defined? writer end ALIASES.each do |_alias, val| writer = "#{_alias}=".to_sym reader = _alias.to_sym unless method_defined? writer define_method("#{_alias}=") do |v| send("#{val}=", v) end end unless method_defined? reader define_method("#{_alias}") do send(val) end end end end def initialize(patset, attrs = {}) # Set the defaults self.class::PATSET_DEFAULTS.each do |k, v| send("#{k}=", v) end # Then the values that have been supplied self.pattern_set = patset attrs.each do |k, v| send("#{k}=", v) end end def to_s l = "\t" self.class::PATSET_ATTRS.each do |attr| l += "#{send(attr)}\t" end "#{l}" end end end end end
Version data entries
107 entries across 107 versions & 1 rubygems