Skip to content

Commit 9bcfdaa

Browse files
committed
fix return value
1 parent 54cb4ff commit 9bcfdaa

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

lib/gnuplotrb/mixins/error_handling.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ def check_errors
2323
end
2424
message = "Error in previous command (\"#{command}\"): \"#{rest}\""
2525
fail GnuplotError, message
26+
self
2627
end
2728

2829
private

lib/gnuplotrb/multiplot.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ def update_plot!(position = 0, **options)
8787
return self unless block_given? if options.empty?
8888
replacement = @plots[position].options!(options)
8989
yield(replacement) if block_given?
90+
self
9091
end
9192

9293
alias_method :update!, :update_plot!
@@ -110,6 +111,7 @@ def replace_plot(position = 0, plot)
110111

111112
def replace_plot!(position = 0, plot)
112113
@plots = @plots.set(position, plot)
114+
self
113115
end
114116

115117
alias_method :replace!, :replace_plot!
@@ -137,6 +139,7 @@ def add_plots(*plots)
137139
def add_plots!(*plots)
138140
plots.unshift(0) unless plots[0].is_a?(Numeric)
139141
@plots = @plots.insert(*plots)
142+
self
140143
end
141144

142145
alias_method :add_plot!, :add_plots!
@@ -159,6 +162,7 @@ def remove_plot(position = -1)
159162

160163
def remove_plot!(position = -1)
161164
@plots = @plots.delete_at(position)
165+
self
162166
end
163167

164168
alias_method :remove!, :remove_plot!

lib/gnuplotrb/plot.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ def update_dataset(position = 0, data: nil, **options)
109109

110110
def update_dataset!(position = 0, data: nil, **options)
111111
@datasets[position].update!(data, options)
112+
self
112113
end
113114

114115
##
@@ -130,6 +131,7 @@ def replace_dataset(position = 0, dataset)
130131

131132
def replace_dataset!(position = 0, dataset)
132133
@datasets = @datasets.set(position, dataset_from_any(dataset))
134+
self
133135
end
134136

135137
alias_method :[]=, :replace_dataset!
@@ -162,6 +164,7 @@ def add_datasets(*datasets)
162164
# first element is position where to add datasets
163165
datasets.unshift(0) unless datasets[0].is_a?(Numeric)
164166
@datasets = @datasets.insert(*datasets)
167+
self
165168
end
166169

167170
##
@@ -181,6 +184,7 @@ def remove_dataset(position = -1)
181184

182185
def remove_dataset!(position = -1)
183186
@datasets = @datasets.delete_at(position)
187+
self
184188
end
185189

186190
##

0 commit comments

Comments
 (0)