Class: Copypasta::Entry::Download
- Defined in:
- lib/copypasta/entry/download.rb
Instance Attribute Summary collapse
-
#source ⇒ Object
readonly
Returns the value of attribute source.
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(filename, source:, only_if: nil) ⇒ Download
constructor
A new instance of Download.
Methods inherited from Base
Constructor Details
#initialize(filename, source:, only_if: nil) ⇒ Download
Returns a new instance of Download.
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/copypasta/entry/download.rb', line 10 def initialize(filename, source:, only_if: nil) raise "filename must be a string." unless filename.is_a?(String) raise "source url '#{source}' looks invalid." \ unless source =~ URI::DEFAULT_PARSER.make_regexp raise "only_if must be null or a Proc." if !only_if.nil? && !only_if.is_a?(Proc) @filename = filename @source = source @only_if = only_if end |
Instance Attribute Details
#source ⇒ Object (readonly)
Returns the value of attribute source.
8 9 10 |
# File 'lib/copypasta/entry/download.rb', line 8 def source @source end |