Module: Staticky::Resources::Plugins::Prelude::InstanceMethods
- Defined in:
- lib/staticky/resources/plugins/prelude.rb
Instance Method Summary collapse
- #build_path ⇒ Object
- #destination ⇒ Object
- #destination=(destination) ⇒ Object
- #filepath ⇒ Object
- #read ⇒ Object
- #root? ⇒ Boolean
- #uri ⇒ Object
- #url ⇒ Object
- #url=(url) ⇒ Object
Instance Method Details
#build_path ⇒ Object
18 19 20 |
# File 'lib/staticky/resources/plugins/prelude.rb', line 18 def build_path destination.join(filepath) end |
#destination ⇒ Object
42 43 44 |
# File 'lib/staticky/resources/plugins/prelude.rb', line 42 def destination @destination ||= Staticky.build_path end |
#destination=(destination) ⇒ Object
46 47 48 |
# File 'lib/staticky/resources/plugins/prelude.rb', line 46 def destination=(destination) @destination = Pathname(destination) end |
#filepath ⇒ Object
22 23 24 25 26 |
# File 'lib/staticky/resources/plugins/prelude.rb', line 22 def filepath return Pathname.new("index.html") if root? Pathname.new("#{uri.path.gsub(%r{^/}, "")}.html") end |
#read ⇒ Object
28 29 30 |
# File 'lib/staticky/resources/plugins/prelude.rb', line 28 def read Staticky.files.read(build_path) end |
#root? ⇒ Boolean
32 33 34 |
# File 'lib/staticky/resources/plugins/prelude.rb', line 32 def root? url == "/" end |
#uri ⇒ Object
36 37 38 39 40 |
# File 'lib/staticky/resources/plugins/prelude.rb', line 36 def uri return @uri if defined?(@uri) raise ArgumentError, "url is required" end |
#url ⇒ Object
50 51 52 53 54 |
# File 'lib/staticky/resources/plugins/prelude.rb', line 50 def url return @url if defined?(@url) raise ArgumentError, "url is required" end |
#url=(url) ⇒ Object
56 57 58 59 |
# File 'lib/staticky/resources/plugins/prelude.rb', line 56 def url=(url) @url = url @uri = parse_url(url) end |