Skip to content

Commit

Permalink
Updated to Crystal 0.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
asterite committed Sep 21, 2015
1 parent bcec257 commit 533fb70
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions spec/cases_spec.cr
Expand Up @@ -38,8 +38,8 @@ private def compare(toml_hash : Hash, json_hash : Hash)
end

private def compare(toml_array : Array, json_array : Array)
if toml_array.length != json_array.length
fail "array lengths differ"
if toml_array.size != json_array.size
fail "array sizes differ"
end

toml_array.zip(json_array) do |toml_value, json_value|
Expand Down
9 changes: 5 additions & 4 deletions src/toml.cr
@@ -1,17 +1,18 @@
# Main entry point for TOML parsing.
module TOML
# Represents a possible type inside a TOML Array or TOML Hash (Table)
alias Type = Bool | Int64 | Float64 | String | Time | Array(Type) | Hash(String, Type)

# A TOML Table. Just a convenience alias.
alias Table = Hash(String, Type)

# Parses a string, returning a `TOML::Table`.
def self.parse(string)
# Parses a string.
def self.parse(string) : TOML::Table
Parser.parse(string)
end

# Parses a file, returning a `TOML::Table`.
def self.parse_file(filename)
# Parses a file.
def self.parse_file(filename) : TOML::Table
parse File.read(filename)
end
end
Expand Down
2 changes: 1 addition & 1 deletion src/toml/lexer.cr
Expand Up @@ -3,7 +3,7 @@ class TOML::Lexer
getter token

def initialize(string)
@reader = CharReader.new(string)
@reader = Char::Reader.new(string)
@token = Token.new
@line_number = 1
@column_number = 1
Expand Down

0 comments on commit 533fb70

Please sign in to comment.