diff --git a/Gemfile.lock b/Gemfile.lock index 7007b90..43b7df1 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,79 +1,65 @@ PATH remote: . specs: - mixture (0.6.2) + mixture (0.7.1) thread_safe (~> 0.3) GEM remote: https://rubygems.org/ specs: - ast (2.0.0) - astrolabe (1.3.0) - parser (>= 2.2.0.pre.3, < 3.0) - coderay (1.1.0) - coveralls (0.8.2) - json (~> 1.8) - rest-client (>= 1.6.8, < 2) - simplecov (~> 0.10.0) + ast (2.3.0) + coderay (1.1.1) + coveralls (0.8.19) + json (>= 1.8, < 3) + simplecov (~> 0.12.0) term-ansicolor (~> 1.3) thor (~> 0.19.1) - diff-lcs (1.2.5) + tins (~> 1.6) + diff-lcs (1.3) docile (1.1.5) - domain_name (0.5.24) - unf (>= 0.0.5, < 1.0.0) - http-cookie (1.0.2) - domain_name (~> 0.5) - json (1.8.3) + json (2.0.3) method_source (0.8.2) - mime-types (2.6.1) - netrc (0.10.3) - parser (2.2.2.6) - ast (>= 1.1, < 3.0) + parser (2.4.0.0) + ast (~> 2.2) powerpack (0.1.1) - pry (0.10.1) + pry (0.10.4) coderay (~> 1.1.0) method_source (~> 0.8.1) slop (~> 3.4) - rainbow (2.0.0) - rake (10.4.2) - rest-client (1.8.0) - http-cookie (>= 1.0.2, < 2.0) - mime-types (>= 1.16, < 3.0) - netrc (~> 0.7) - rspec (3.3.0) - rspec-core (~> 3.3.0) - rspec-expectations (~> 3.3.0) - rspec-mocks (~> 3.3.0) - rspec-core (3.3.1) - rspec-support (~> 3.3.0) - rspec-expectations (3.3.0) + rainbow (2.2.1) + rake (12.0.0) + rspec (3.5.0) + rspec-core (~> 3.5.0) + rspec-expectations (~> 3.5.0) + rspec-mocks (~> 3.5.0) + rspec-core (3.5.4) + rspec-support (~> 3.5.0) + rspec-expectations (3.5.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.3.0) - rspec-mocks (3.3.1) + rspec-support (~> 3.5.0) + rspec-mocks (3.5.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.3.0) - rspec-support (3.3.0) - rubocop (0.32.1) - astrolabe (~> 1.3) - parser (>= 2.2.2.5, < 3.0) + rspec-support (~> 3.5.0) + rspec-support (3.5.0) + rubocop (0.47.1) + parser (>= 2.3.3.1, < 3.0) powerpack (~> 0.1) rainbow (>= 1.99.1, < 3.0) - ruby-progressbar (~> 1.4) - ruby-progressbar (1.7.5) - simplecov (0.10.0) + ruby-progressbar (~> 1.7) + unicode-display_width (~> 1.0, >= 1.0.1) + ruby-progressbar (1.8.1) + simplecov (0.12.0) docile (~> 1.1.0) - json (~> 1.8) + json (>= 1.8, < 3) simplecov-html (~> 0.10.0) simplecov-html (0.10.0) slop (3.6.0) - term-ansicolor (1.3.2) + term-ansicolor (1.4.0) tins (~> 1.0) - thor (0.19.1) - thread_safe (0.3.5) - tins (1.5.4) - unf (0.1.4) - unf_ext - unf_ext (0.0.7.1) + thor (0.19.4) + thread_safe (0.3.6) + tins (1.13.2) + unicode-display_width (1.1.3) PLATFORMS ruby @@ -88,4 +74,4 @@ DEPENDENCIES rubocop BUNDLED WITH - 1.10.6 + 1.13.6 diff --git a/lib/mixture/extensions/attributable.rb b/lib/mixture/extensions/attributable.rb index 5782d61..52826f7 100644 --- a/lib/mixture/extensions/attributable.rb +++ b/lib/mixture/extensions/attributable.rb @@ -29,12 +29,17 @@ def attribute(name, options = {}) # @see AttributeList # @return [AttributeList] def attributes - return @_attributes if @_attributes + @_attributes ||= build_attributes + end + + private + + def build_attributes available = ancestors[1..-1] .select { |c| c.respond_to?(:attributes) } .first parent = available ? available.attributes : nil - @_attributes = AttributeList.new(parent) + AttributeList.new(parent) end end @@ -66,7 +71,7 @@ def attributes # @param attr [Symbol] The attribute. # @raise [ArgumentError] def unknown_attribute(attr) - fail ArgumentError, "Unknown attribute #{attr} passed" + fail ArgumentError, "Unknown attribute #{attr.inspect} passed" end # @overload attribute(key) diff --git a/lib/mixture/version.rb b/lib/mixture/version.rb index 31e2ec0..c549090 100644 --- a/lib/mixture/version.rb +++ b/lib/mixture/version.rb @@ -6,5 +6,5 @@ module Mixture # The current version of Mixture. # # @return [String] - VERSION = "0.7.0" + VERSION = "0.7.1" end