Sha256: c037db18fb0c921f847f94776cef51f59d270344ae548421b93a0d0e6818464e

Contents?: true

Size: 1.26 KB

Versions: 2

Compression:

Stored size: 1.26 KB

Contents

# encoding: utf-8

require_relative "qipowl/version"
require_relative "qipowl/constants"

require_relative "qipowl/core/mapper"
require_relative "qipowl/core/ruler"
require_relative "qipowl/core/bowler"

require_relative "qipowl/bowlers/html"
require_relative "qipowl/bowlers/i_sp_ru"
#require_relative "qipowl/bowlers/cmd"
#require_relative "qipowl/bowlers/yaml"

Encoding.default_external = Encoding::UTF_8
Encoding.default_internal = Encoding::UTF_8

module Qipowl
  extend self

  # Basic single-method DSL with .parameter method
  # being used to define a set of available settings.
  # This method takes one or more symbols, with each one being
  # a name of the configuration option.
  def params *names
    names.each do |name|
      attr_accessor name
      define_method name do |*values|
        value = values.first
        value ? self.send("#{name}=", value) : instance_variable_get("@#{name}")
      end
    end
  end

  # A wrapper for the configuration block
  def config &block
    instance_eval(&block)
  end

end

Qipowl::config do
  params :bowlers_dir
  bowlers_dir File.expand_path(File.join(__dir__, '..', 'config', 'bowlers'))
end

class Qipowl::Html
  attr_reader :bowler
  def self.parse s
    (@bowler ||= Qipowl::Ruler.new_bowler "html").execute s
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
qipowl-0.9.3 lib/qipowl.rb
qipowl-0.9.2 lib/qipowl.rb