Class: Cask::URL::BlockDSL Private
This class is part of a private API. This class may only be used in the Homebrew/brew repository. Third parties should avoid using this class if possible, as it may be removed or changed without warning.
Defined Under Namespace
Modules: PageWithURL
Instance Method Summary collapse
- #call ⇒ URI::Generic, ... private
- #initialize(uri, dsl:, &block) ⇒ void constructor private
Constructor Details
#initialize(uri, dsl:, &block) ⇒ void
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
116 117 118 119 120 |
# File 'cask/url.rb', line 116 def initialize(uri, dsl:, &block) @uri = uri @dsl = dsl @block = block end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object (private)
This allows calling DSL methods from inside a url
block.
156 157 158 159 160 161 162 |
# File 'cask/url.rb', line 156 def method_missing(method, *args, &block) if @dsl.respond_to?(method) @dsl.public_send(method, *args, &block) else super end end |
Instance Method Details
#call ⇒ URI::Generic, ...
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
123 124 125 126 127 128 129 130 131 132 133 134 135 136 |
# File 'cask/url.rb', line 123 def call if @uri result = ::Utils::Curl.curl_output("--fail", "--silent", "--location", @uri) result.assert_success! page = result.stdout page.extend PageWithURL page.url = URI(@uri) instance_exec(page, &@block) else instance_exec(&@block) end end |