Module: Staticky::Resources::Plugins::Prelude::InstanceMethods
- Defined in:
- lib/staticky/resources/plugins/prelude.rb
Instance Method Summary collapse
- #basename ⇒ Object
- #destination ⇒ Object
- #destination=(destination) ⇒ Object
- #filepath ⇒ Object
- #read ⇒ Object
- #root? ⇒ Boolean
- #uri ⇒ Object
- #url ⇒ Object
- #url=(url) ⇒ Object
Instance Method Details
#basename ⇒ Object
26 27 28 |
# File 'lib/staticky/resources/plugins/prelude.rb', line 26 def basename root? ? "index.html" : "#{url}.html" end |
#destination ⇒ Object
40 41 42 |
# File 'lib/staticky/resources/plugins/prelude.rb', line 40 def destination @destination ||= Staticky.build_path end |
#destination=(destination) ⇒ Object
44 45 46 |
# File 'lib/staticky/resources/plugins/prelude.rb', line 44 def destination=(destination) @destination = Pathname(destination) end |
#filepath ⇒ Object
18 19 20 |
# File 'lib/staticky/resources/plugins/prelude.rb', line 18 def filepath destination.join(basename) end |
#read ⇒ Object
22 23 24 |
# File 'lib/staticky/resources/plugins/prelude.rb', line 22 def read filepath.read end |
#root? ⇒ Boolean
30 31 32 |
# File 'lib/staticky/resources/plugins/prelude.rb', line 30 def root? url == "/" end |
#uri ⇒ Object
34 35 36 37 38 |
# File 'lib/staticky/resources/plugins/prelude.rb', line 34 def uri return @uri if defined?(@uri) raise ArgumentError, "url is required" end |
#url ⇒ Object
48 49 50 51 52 |
# File 'lib/staticky/resources/plugins/prelude.rb', line 48 def url return @url if defined?(@url) raise ArgumentError, "url is required" end |
#url=(url) ⇒ Object
54 55 56 57 |
# File 'lib/staticky/resources/plugins/prelude.rb', line 54 def url=(url) @url = url @uri = parse_url(url) end |