Skip to content

Commit 754b0f1

Browse files
committed
Initialize instance variables and use attr_writer.
Rake 11 runs with Ruby warnings enabled by default. - Initialize instance variables. - Addresses: 'warning: instance variable @[variable name] not initialized' - Replace `attr_accessor` with `attr_writer` to avoid redefining the `attr_reader`. - Addresses: 'warning: method redefined; discarding old [method name]'
1 parent 5e1f87b commit 754b0f1

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

lib/pandoc-ruby.rb

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,24 +71,24 @@ def self.convert(*args)
7171
new(*args).convert
7272
end
7373

74-
attr_accessor :options
74+
attr_writer :options
7575
def options
76-
@options || []
76+
@options ||= []
7777
end
7878

79-
attr_accessor :option_string
79+
attr_writer :option_string
8080
def option_string
81-
@option_string || ''
81+
@option_string ||= ''
8282
end
8383

84-
attr_accessor :binary_output
84+
attr_writer :binary_output
8585
def binary_output
86-
@binary_output || false
86+
@binary_output ||= false
8787
end
8888

89-
attr_accessor :writer
89+
attr_writer :writer
9090
def writer
91-
@writer || 'html'
91+
@writer ||= 'html'
9292
end
9393

9494
# Create a new PandocRuby converter object. The first argument contains the
@@ -101,6 +101,9 @@ def writer
101101
# new(["/path/to/file.md"], :option1 => :value, :option2)
102102
# new(["/to/file1.html", "/to/file2.html"], :option1 => :value)
103103
def initialize(*args)
104+
@input_string = nil
105+
@input_files = nil
106+
104107
if args[0].is_a?(String)
105108
@input_string = args.shift
106109
elsif args[0].is_a?(Array)

0 commit comments

Comments
 (0)