Skip to content

Commit

Permalink
Drop unnecessary assignment
Browse files Browse the repository at this point in the history
  • Loading branch information
k0kubun committed Jan 31, 2017
1 parent 240813d commit a9c9f99
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
3 changes: 1 addition & 2 deletions lib/haml/compiler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ class Compiler
attr_accessor :options

def initialize(options)
@options = options
@options = Options.new(options) unless options.is_a?(Options)
@options = Options.wrap(options)
@output_tabs = 0
@to_merge = []
@precompiled = ''
Expand Down
8 changes: 8 additions & 0 deletions lib/haml/options.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,14 @@ def self.buffer_option_keys
@buffer_option_keys
end

def self.wrap(options)
if options.is_a?(Options)
options
else
Options.new(options)
end
end

# The character that should wrap element attributes. This defaults to `'`
# (an apostrophe). Characters of this type within the attributes will be
# escaped (e.g. by replacing them with `'`) if the character is an
Expand Down
4 changes: 1 addition & 3 deletions lib/haml/parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,7 @@ class Parser
CLASS_KEY = 'class'.freeze

def initialize(options)
@options = options
@options = Options.new(options) unless options.is_a?(Options)

@options = Options.wrap(options)
# Record the indent levels of "if" statements to validate the subsequent
# elsif and else statements are indented at the appropriate level.
@script_level_stack = []
Expand Down

0 comments on commit a9c9f99

Please sign in to comment.