<commit_before>
module Nucleon
module Plugin
class Base < Core
  
  # All Plugin classes should directly or indirectly extend Base
  
  def initialize(type, provider, options)
    config = Util::Data.clean(Config.ensure(options))
    name   = Util::Data.ensure_value(config.delete(:plugin_name), config.delete(:name, provider))
    
    @quiet = config.delete(:quiet, false)
       
    set_meta(config.delete(:meta, Config.new))
    
    # No logging statements aove this line!!
    super(config.import({ :logger => "#{plugin_type}->#{plugin_provider}" }))
    myself.plugin_name = name
    
    logger.debug("Normalizing #{plugin_type} plugin #{plugin_name} with meta data: #{meta.inspect}")
    normalize
  end
  
  #---
  
  def method_missing(method, *args, &block)  
    return nil  
  end
  
  #-----------------------------------------------------------------------------
  # Checks
  
  def initialized?(options = {})
    return true  
  end
  
  #---
  
  def quiet?
    @quiet
  end
   
  #-----------------------------------------------------------------------------
  # Property accessor / modifiers
  
  def myself
    return current_actor if respond_to?(:current_actor) # Celluloid enhanced plugin
    self
  end
  alias_method :me, :myself
  
  #---
  
  def quiet=quiet
    @quiet = quiet
  end
  
  #---
  
  def meta
    return @meta
  end
  
  #---
  
  def set_meta(meta)
    @meta = Config.ensure(meta)
  end
  
  #---
  
  def plugin_name
    return meta.get(:name)
  end
  
  def plugin_name=plugin_name
    meta.set(:name, string(plugin_name))
  end
  
  #---
  
  def plugin_type
    return meta.get(:type)
  end
  
  #---
  
  def plugin_provider
    return meta.get(:provider)
  end
  
  #---
  
  def plugin_directory
    return meta.get(:directory)<commit_msg>Adding a namespace reader and moving the name property in the base plugin class.<commit_after>
module Nucleon
module Plugin
class Base < Core
  
  # All Plugin classes should directly or indirectly extend Base
  
  def initialize(type, provider, options)
    config = Util::Data.clean(Config.ensure(options))
    name   = Util::Data.ensure_value(config.delete(:plugin_name), config.delete(:name, provider))
    
    @quiet = config.delete(:quiet, false)
       
    set_meta(config.delete(:meta, Config.new))
    
    # No logging statements aove this line!!
    super(config.import({ :logger => "#{plugin_type}->#{plugin_provider}" }))
    myself.plugin_name = name
    
    logger.debug("Normalizing #{plugin_type} plugin #{plugin_name} with meta data: #{meta.inspect}")
    normalize
  end
  
  #---
  
  def method_missing(method, *args, &block)  
    return nil  
  end
  
  #-----------------------------------------------------------------------------
  # Checks
  
  def initialized?(options = {})
    return true  
  end
  
  #---
  
  def quiet?
    @quiet
  end
   
  #-----------------------------------------------------------------------------
  # Property accessor / modifiers
  
  def myself
    return current_actor if respond_to?(:current_actor) # Celluloid enhanced plugin
    self
  end
  alias_method :me, :myself
  
  #---
  
  def quiet=quiet
    @quiet = quiet
  end
  
  #---
  
  def meta
    return @meta
  end
  
  #---
  
  def set_meta(meta)
    @meta = Config.ensure(meta)
  end
  
  #---
  
  def plugin_namespace
    return meta.get(:namespace)
  end
  
  #---
  
  def plugin_type
    return meta.get(:type)
  end
  
  #---
  
  def plugin_provider
    return meta.get(:provider)
  end
  
  #---
  
  def plugin_name
    return meta.get(:name)
  end
  
  def plugin_name=plugin_name
    meta.set(:name, string(plugin_name))
  end
  
  #---
  
  def plugin_directory
    return meta.get(:directory)
{'fraction_non_alphanumeric': 0.18624025799516258, 'fraction_numerical': 0.0, 'mean_word_length': 1.865280985373364, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3792354', 'n_tokens_mistral': 1171, 'n_tokens_neox': 1158, 'n_words': 269}