Sha256: afc133482caefdc322113318fda10540a52bc7d8537f7317f1280e2837b076b8

Contents?: true

Size: 1015 Bytes

Versions: 7

Compression:

Stored size: 1015 Bytes

Contents

# Example of extending built in Perennial
# functionality. Since const_get etc acts
# oddly, this is the best way to do it.
Marvin::Settings.class_eval do
  
  def self.parser
    # We use SimpleParser by default because it is almost
    # 20 times faster (from basic benchmarks) than the Ragel
    # based parser. If you're having issues with unexpected
    # results, please try using Ragel as the parser for you
    # application - It was (afaik) almost a direct port
    # from the RFC where as I've taken some liberties with
    # simple parser for the expected reasons.
    @@parser ||= Marvin::Parsers::SimpleParser
  end
  
  def self.parser=(value)
    raise ArgumentError, 'Is not a valid parser implementation' unless value < Marvin::AbstractParser
    @@parser = value
  end
  
  def self.client
    @@client ||= Marvin::IRC::Client
  end
  
  def self.client=(value)
    raise ArgumentError, 'Is not a valid client implementation' unless value < Marvin::AbstractClient
    @@client = value
  end
  
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
Sutto-marvin-0.8.0.0 lib/marvin/settings.rb
Sutto-marvin-0.8.0.1 lib/marvin/settings.rb
marvin-0.8.2 lib/marvin/settings.rb
marvin-0.8.1 lib/marvin/settings.rb
marvin-0.8.0.2 lib/marvin/settings.rb
marvin-0.8.0.1 lib/marvin/settings.rb
marvin-0.8.0.0 lib/marvin/settings.rb