Module: CassetteRack::Configure
- Defined in:
- lib/cassette-rack/configure.rb
Class Attribute Summary collapse
-
.cassette_path ⇒ Object
Returns the value of attribute cassette_path.
- .content_layout ⇒ Object
-
.url ⇒ Object
Returns the value of attribute url.
Class Method Summary collapse
- .application_layout ⇒ Object
- .application_template ⇒ Object
- .content_template ⇒ Object
- .keys ⇒ Object
- .preview_layout ⇒ Object
- .preview_template ⇒ Object
- .setup ⇒ Object
- .source_path ⇒ Object
- .templates_path ⇒ Object
Class Attribute Details
.cassette_path ⇒ Object
Returns the value of attribute cassette_path.
7 8 9 |
# File 'lib/cassette-rack/configure.rb', line 7 def cassette_path @cassette_path end |
.content_layout ⇒ Object
38 39 40 |
# File 'lib/cassette-rack/configure.rb', line 38 def content_layout @content_layout ||= File.('content.md.liquid', File.join(self.templates_path, 'layouts')) end |
.url ⇒ Object
Returns the value of attribute url.
7 8 9 |
# File 'lib/cassette-rack/configure.rb', line 7 def url @url end |
Class Method Details
.application_layout ⇒ Object
34 35 36 |
# File 'lib/cassette-rack/configure.rb', line 34 def application_layout @application_layout ||= File.('application.html.liquid', File.join(self.templates_path, 'layouts')) end |
.application_template ⇒ Object
46 47 48 |
# File 'lib/cassette-rack/configure.rb', line 46 def application_template File.read(self.application_layout) end |
.content_template ⇒ Object
50 51 52 |
# File 'lib/cassette-rack/configure.rb', line 50 def content_template File.read(self.content_layout) end |
.keys ⇒ Object
22 23 24 |
# File 'lib/cassette-rack/configure.rb', line 22 def keys @keys ||= %i[cassette_path url] end |
.preview_layout ⇒ Object
42 43 44 |
# File 'lib/cassette-rack/configure.rb', line 42 def preview_layout @preview_layout ||= File.('preview.liquid', File.join(self.templates_path, 'layouts')) end |
.preview_template ⇒ Object
54 55 56 |
# File 'lib/cassette-rack/configure.rb', line 54 def preview_template File.read(self.preview_layout) end |
.setup ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/cassette-rack/configure.rb', line 10 def setup keys.each do |key| instance_variable_set(:"@#{key}", CassetteRack::Default.send(key)) end FileUtils.mkdir_p(self.source_path) VCR.configure do |config| config.cassette_library_dir = self.source_path end end |
.source_path ⇒ Object
26 27 28 |
# File 'lib/cassette-rack/configure.rb', line 26 def source_path @source_path ||= File.(self.cassette_path) end |
.templates_path ⇒ Object
30 31 32 |
# File 'lib/cassette-rack/configure.rb', line 30 def templates_path @templates_path ||= CassetteRack.root.join('lib', 'templates').to_s end |