diff --git a/Gemfile.lock b/Gemfile.lock index c01093e..3d4234a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - schoolie (0.1.1) + schoolie (0.1.2) rails (~> 5) GEM @@ -50,7 +50,6 @@ GEM tzinfo (~> 1.1) arel (9.0.0) ast (2.4.2) - bixby (0.1.0) builder (3.2.4) byebug (11.1.3) concurrent-ruby (1.1.9) @@ -128,10 +127,6 @@ GEM parser (>= 3.0.1.1) rubocop-minitest (0.17.2) rubocop (>= 0.90, < 2.0) - rubocop-rails (2.13.2) - activesupport (>= 4.2.0) - rack (>= 1.1) - rubocop (>= 1.7.0, < 2.0) ruby-progressbar (1.11.0) simplecov (0.16.1) docile (~> 1.1) @@ -163,7 +158,6 @@ PLATFORMS x86_64-linux DEPENDENCIES - bixby byebug coveralls-ruby minitest (~> 5.0) @@ -171,7 +165,6 @@ DEPENDENCIES rake (~> 13.0) rubocop (~> 1.21) rubocop-minitest - rubocop-rails schoolie! simplecov diff --git a/lib/helpers/schoolie_helper.rb b/lib/helpers/schoolie_helper.rb index fb9e3ab..a36e7fd 100644 --- a/lib/helpers/schoolie_helper.rb +++ b/lib/helpers/schoolie_helper.rb @@ -7,10 +7,10 @@ module SchoolieHelper def schoolie_tags(concern, config = Rails.root.join("config/schoolie.yml")) m = load_map(config) - tags = m[:static].map do |k, v| + tags = m["static"].map do |k, v| tag.meta(name: k, value: v) end - tags << m[:attributes].map do |k, v| + tags << m["attributes"].map do |k, v| tag.meta(name: k, value: concern.send(v)) rescue StandardError warn("Undefined attribute mapping: #{k} -> #{v}") @@ -21,6 +21,6 @@ def schoolie_tags(concern, config = Rails.root.join("config/schoolie.yml")) private def load_map(config) - @load_map ||= YAML.safe_load(File.open(config, "r")) + @load_map ||= YAML.safe_load(File.open(config, "r"), [Symbol]) end end diff --git a/lib/schoolie/version.rb b/lib/schoolie/version.rb index 8adc2d5..c2d964a 100644 --- a/lib/schoolie/version.rb +++ b/lib/schoolie/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module Schoolie - VERSION = "0.1.1" + VERSION = "0.1.2" end diff --git a/test/fixtures/schoolie.yml b/test/fixtures/schoolie.yml index 0c073d6..30d4782 100644 --- a/test/fixtures/schoolie.yml +++ b/test/fixtures/schoolie.yml @@ -1,9 +1,9 @@ --- -:static: - Institution: Emory & University -:attributes: - Title: title - Author: creator - Abstract: abstract - Type: submitting_type - Date: degree_awarded +static: + "Institution": Emory & University +attributes: + "Title": title + "Author": creator + "Abstract": abstract + "Type": submitting_type + "Date": degree_awarded diff --git a/test/schoolie_test.rb b/test/schoolie_test.rb index 2bb69fb..30f2676 100644 --- a/test/schoolie_test.rb +++ b/test/schoolie_test.rb @@ -44,6 +44,6 @@ def test_has_a_helper_and_it_escapes_html def test_doesnt_blow_up_on_missing_method obj = Object.new assert_equal "", - Foo.new.schoolie_tags(obj, "test/fixtures/schoolie.yml") + Foo.new.schoolie_tags(obj, "test/fixtures/schoolie.yml").strip end end