Skip to content

Commit

Permalink
Allow to pass option :empty_tag_value to Nori via local options
Browse files Browse the repository at this point in the history
  • Loading branch information
ekzobrain authored and pcai committed Jul 15, 2024
1 parent 201d799 commit a5bdcb9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
.byebug_history
.DS_Store
.yardoc
.ruby-version
doc
rdox
coverage
Expand Down
5 changes: 5 additions & 0 deletions lib/savon/options.rb
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,11 @@ def response_parser(parser)
@options[:response_parser] = parser
end

# Instruct Nori how to convert empty tags.
def empty_tag_value(empty_tag_value)
@options[:empty_tag_value] = empty_tag_value
end

# Instruct Savon to create a multipart response if available.
def multipart(multipart)
@options[:multipart] = multipart
Expand Down
3 changes: 2 additions & 1 deletion lib/savon/response.rb
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,8 @@ def nori
:convert_tags_to => @globals[:convert_response_tags_to],
:convert_attributes_to => @globals[:convert_attributes_to],
:advanced_typecasting => @locals[:advanced_typecasting],
:parser => @locals[:response_parser]
:parser => @locals[:response_parser],
:empty_tag_value => @locals[:empty_tag_value]
}

non_nil_nori_options = nori_options.reject { |_, value| value.nil? }
Expand Down

0 comments on commit a5bdcb9

Please sign in to comment.