Sha256: 11f7d9596403d242d3bae899c7451f8f568085765a3fb48e0b15587f872d8c10

Contents?: true

Size: 597 Bytes

Versions: 1

Compression:

Stored size: 597 Bytes

Contents

# Ruby interface to Tidylib options
#
class Tidyopt

  # Construct a new instance
  #
  def initialize(doc)
    @doc = doc
  end
    
  # Reader for options (Hash syntax)
  #
  def [](name)
    Tidylib.opt_get_value(@doc, name)
  end
    
  # Writer for options (Hash syntax)
  #
  def []=(name, value)
    Tidylib.opt_parse_value(@doc, name, value)
  end
    
  # Reader/Writer for options (Object syntax)
  #
  def method_missing(name, value=:none, *args)
    name = name.to_s.sub('=', '')
    return self[name] if value == :none
    self[name] = value
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tidy-1.0.0 lib/tidy/tidyopt.rb