Skip to content
  • Sean Doyle's avatar
    8dc27b59
    Support `Object#with_options` without a block · 8dc27b59
    Sean Doyle authored
    When the block argument is omitted, the decorated Object instance is returned:
    
    ```ruby
     # app/helpers/my_styled_helpers.rb
     module MyStyledHelpers
       def styled
         with_options style: "color: red;"
       end
     end
    
     # styled.link_to "I'm red", "/"
     # #=> <a href="/" style="color: red;">I'm red</a>
    
     # styled.button_tag "I'm red too!"
     # #=> <button style="color: red;">I'm red too!</button>
    ```
    8dc27b59
    Support `Object#with_options` without a block
    Sean Doyle authored
    When the block argument is omitted, the decorated Object instance is returned:
    
    ```ruby
     # app/helpers/my_styled_helpers.rb
     module MyStyledHelpers
       def styled
         with_options style: "color: red;"
       end
     end
    
     # styled.link_to "I'm red", "/"
     # #=> <a href="/" style="color: red;">I'm red</a>
    
     # styled.button_tag "I'm red too!"
     # #=> <button style="color: red;">I'm red too!</button>
    ```
Loading