From faa518b3a32d14d63a53e700821484bc668aff69 Mon Sep 17 00:00:00 2001 From: Takashi Kokubun Date: Sat, 5 Dec 2015 13:39:07 +0900 Subject: [PATCH] Rename HashParser to AttributeParser since this module can parse both hash and hash without bracket. --- lib/hamlit/{hash_parser.rb => attribute_parser.rb} | 2 +- lib/hamlit/compiler/attribute_compiler.rb | 4 ++-- test/hamlit/{hash_parser_test.rb => attribute_parser_test.rb} | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) rename lib/hamlit/{hash_parser.rb => attribute_parser.rb} (99%) rename test/hamlit/{hash_parser_test.rb => attribute_parser_test.rb} (98%) diff --git a/lib/hamlit/hash_parser.rb b/lib/hamlit/attribute_parser.rb similarity index 99% rename from lib/hamlit/hash_parser.rb rename to lib/hamlit/attribute_parser.rb index ca6b83fd..fa7ed8be 100644 --- a/lib/hamlit/hash_parser.rb +++ b/lib/hamlit/attribute_parser.rb @@ -1,7 +1,7 @@ require 'hamlit/ruby_expression' module Hamlit - class HashParser + class AttributeParser class ParseSkip < StandardError end diff --git a/lib/hamlit/compiler/attribute_compiler.rb b/lib/hamlit/compiler/attribute_compiler.rb index afee2b05..318561e4 100644 --- a/lib/hamlit/compiler/attribute_compiler.rb +++ b/lib/hamlit/compiler/attribute_compiler.rb @@ -1,5 +1,5 @@ require 'hamlit/attribute_builder' -require 'hamlit/hash_parser' +require 'hamlit/attribute_parser' require 'hamlit/ruby_expression' require 'hamlit/static_analyzer' require 'hamlit/string_interpolation' @@ -18,7 +18,7 @@ module Hamlit hashes = [] return runtime_compile(node) if node.value[:object_ref] != :nil node.value[:attributes_hashes].each do |attribute_str| - hash = HashParser.parse(attribute_str) + hash = AttributeParser.parse(attribute_str) return runtime_compile(node) unless hash hashes << hash end diff --git a/test/hamlit/hash_parser_test.rb b/test/hamlit/attribute_parser_test.rb similarity index 98% rename from test/hamlit/hash_parser_test.rb rename to test/hamlit/attribute_parser_test.rb index 75d25e7a..543edae8 100644 --- a/test/hamlit/hash_parser_test.rb +++ b/test/hamlit/attribute_parser_test.rb @@ -1,7 +1,7 @@ -describe Hamlit::HashParser do +describe Hamlit::AttributeParser do describe '.parse' do def assert_parse(expected, haml) - actual = Hamlit::HashParser.parse(haml) + actual = Hamlit::AttributeParser.parse(haml) assert_equal expected, actual end