Class: Architecture::Prepend
- Inherits:
-
Object
- Object
- Architecture::Prepend
- Includes:
- Contentable, Entityable
- Defined in:
- lib/architecture/prepend.rb
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(source:, content: "", context: {}) ⇒ Prepend
constructor
A new instance of Prepend.
Constructor Details
#initialize(source:, content: "", context: {}) ⇒ Prepend
Returns a new instance of Prepend.
6 7 8 9 10 |
# File 'lib/architecture/prepend.rb', line 6 def initialize(source:, content: "", context: {}) @entity = Entity.new(path: source) @content = content @context = context end |
Instance Method Details
#call ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/architecture/prepend.rb', line 12 def call if entity.file? entity.write(text: data) else raise ArgumentError, "Source wasn't a file" end end |