Module: Tmxed

Extended by:
Tmxed
Included in:
Tmxed
Defined in:
lib/tmxed.rb,
lib/tmxed/map.rb,
lib/tmxed/layer.rb,
lib/tmxed/version.rb,
lib/tmxed/tile_set.rb,
lib/tmxed/parsers/json.rb,
lib/tmxed/parsers/parsers.rb,
lib/tmxed/parsers/unknown.rb

Defined Under Namespace

Modules: Parser, Parsers Classes: Layer, Map, TileSet

Constant Summary collapse

VERSION =
"0.0.1"

Instance Method Summary collapse

Instance Method Details

#parse(filename, options = {}) ⇒ Object

Parse the specified TMX file and return a Map that was found.



14
15
16
17
18
19
# File 'lib/tmxed.rb', line 14

def parse(filename,options={})
  options[:format] = File.extname(filename)[1..-1] unless options[:format]
  file_contents = File.read(filename)
  contents = parser(options).parse(file_contents)
  Map.new contents.merge(contents: contents)
end