pea 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. data/lib/pea.rb +14 -3
  2. metadata +1 -1
data/lib/pea.rb CHANGED
@@ -1,12 +1,19 @@
1
1
  class Pea
2
2
 
3
- attr_accessor :file_contents, :file, :hash, :rendered
3
+ attr_accessor :contents, :file, :hash, :rendered
4
4
 
5
- def initialize(file = nil)
5
+ def initialize(file = nil, relative_to = nil)
6
+ unless file.nil?
7
+ self.read(file, relative_to)
8
+ end
6
9
  end
7
10
 
8
11
 
9
- def read(file)
12
+ def read(file, relative_to = nil)
13
+
14
+ unless relative_to.nil?
15
+ file = File.join(relative_to, file)
16
+ end
10
17
 
11
18
  @file = File.new file, "r"
12
19
 
@@ -18,10 +25,14 @@ class Pea
18
25
  end
19
26
 
20
27
  @contents = file_contents
28
+
29
+ return self
21
30
  end
22
31
 
23
32
  def read_static(static_contents)
24
33
  @contents = static_contents
34
+
35
+ return self
25
36
  end
26
37
 
27
38
  def render(hash)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pea
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: