Skip to content

Commit

Permalink
Add method for retrieving any option from render_options or nil instead
Browse files Browse the repository at this point in the history
  • Loading branch information
ashgaliyev committed May 2, 2019
1 parent 3d772ea commit f2b65ca
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/react_on_rails/react_component/render_options.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ def to_s
"{ react_component_name = #{react_component_name}, options = #{options}, request_digest = #{request_digest}"
end

def option(key)
options.fetch(key) { nil }
end

private

attr_reader :options
Expand Down

0 comments on commit f2b65ca

Please sign in to comment.