Sha256: 068998dbfcc3efbbc3eeb84dd60667a3f894591e0d21ecd21d464bb6d3dd1cf9

Contents?: true

Size: 1.51 KB

Versions: 2

Compression:

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

2 entries across 2 versions & 1 rubygems

Version Path
origen_testers-0.13.2 lib/origen_testers/igxl_based_tester/base/patset_pattern.rb
origen_testers-0.10.0 lib/origen_testers/igxl_based_tester/base/patset_pattern.rb