Class: OsuRuby::Parser::Base

Inherits:
Object
  • Object
show all
Defined in:
(osu-ruby2 0.0.2) osu-ruby2/parser/base.rb

Overview

Base-class for parsing human editable text-file related to osu! content.

Parser Sekelton uses 3 functionality to work.

  • Reader, text file to machine variables conversion. Uses Section and Entry to help.

  • Writer, machine variables to text file. Make a use of #compile_contents and Section#to_s.

  • Converter, passes machine variables into Behavior specific container that accepts given variables. See #convert

These functionality defines on how parser works in general and will be implemented in detail by its subclasses.

Direct Known Subclasses

RawFile

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeBase

Returns a new instance of Base.

Class Method Details

.load(fn) ⇒ Base

Note:

All IO variables retrieved from this method always closed after parsing.

parse file from given filename

Parameters:

  • fn (String)

    filename to read

Returns:

Instance Method Details

#compile_contentsString

This method is abstract.

Section compilation implmenetations are handled by subclasses.

compiles editable contents into an osu!-supported strings.

Returns:

  • (String)

#convertObject #convert(obj) ⇒ Object

This method is abstract.

This is only to document how convert function expected to work. Further implementations are handled by its subclasses.

Overloads:

  • #convertObject

    create new object using given parsed structure data.

  • #convert(obj) ⇒ Object

    Parameters:

    • obj (Object)

      Object-class descendant to have its internal overwritten with given structure data.

Returns:

  • (Object)

#parse(io)

This method is abstract.

parse given IO input to program editable contents

This method returns an undefined value.

Parameters:

  • io (#read)

    Readable IO stream to parse

#write(fn) #write(io)

This method returns an undefined value.

Overloads:

  • #write(fn)

    Writes parsed content to a file with given filename

    Parameters:

    • fn (String)

      filename of target file

  • #write(io)

    writes parsed content to an IO object.

    Parameters:

    • io (#write)

      Writable IO object

See Also: