Skip to content

Commit

Permalink
Fixed Ruby warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
jodosha committed Mar 22, 2016
1 parent 0b91a5f commit 1f60c53
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 11 deletions.
3 changes: 2 additions & 1 deletion lib/hanami/view/dsl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def root(value = nil)
# Articles::JsonShow.format # => :json
def format(value = nil)
if value.nil?
@format
@format ||= nil
else
@format = value
end
Expand Down Expand Up @@ -314,6 +314,7 @@ def template(value = nil)
# Articles::Show.layout # => Hanami::View::Rendering::NullLayout
def layout(value = nil)
if value.nil?
@layout ||= nil
@_layout ||= Rendering::LayoutFinder.find(@layout || configuration.layout, configuration.namespace)
elsif !value
@layout = Hanami::View::Rendering::NullLayout
Expand Down
5 changes: 4 additions & 1 deletion lib/hanami/view/rendering/layout_scope.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ class LayoutScope < BasicObject
# @api private
# @since 0.1.0
def initialize(layout, scope)
@layout, @scope = layout, scope
@layout = layout
@scope = scope
@view = nil
@locals = nil
end

# Returns the classname as string
Expand Down
4 changes: 3 additions & 1 deletion lib/hanami/view/rendering/scope.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ class Scope < LayoutScope
# @api private
# @since 0.1.0
def initialize(view, locals = {})
@view, @locals, @layout = view, locals, layout
@view = view
@locals = locals
@layout = layout
end

# Returns an inspect String
Expand Down
8 changes: 0 additions & 8 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,6 @@ def unload!
def include?(object)
@paths.include?(object)
end

def ==(other)
other.kind_of?(Hanami::Utils::LoadPaths) &&
other.paths == self.paths
end

protected
attr_reader :paths
end

Hanami::View::Configuration.class_eval do
Expand Down

0 comments on commit 1f60c53

Please sign in to comment.