Skip to content

Commit

Permalink
lib/lkp_pattern.rb: support arbitrary path
Browse files Browse the repository at this point in the history
Signed-off-by: Philip Li <philip.li@intel.com>
  • Loading branch information
rli9 committed Oct 25, 2023
1 parent 6c3fe57 commit 2162c3c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/lkp_pattern.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,22 @@ def load
end

class << self
attr_reader :klass_2_path

def generate_klass(file_path)
@klass_2_path ||= {}

klass = Class.new(self) do
include Singleton

def initialize
file_name = self.class.name.sub(/^LKP::/, '').underscore.dasherize
super LKP::Path.src('etc', file_name)
super self.class.superclass.klass_2_path[self.class.name]
end
end

LKP.const_set File.basename(file_path).underscore.camelize, klass

@klass_2_path[klass.name] = file_path
end
end
end
Expand Down

0 comments on commit 2162c3c

Please sign in to comment.