Class: Copypasta::Entry::Literal

Inherits:
Base
  • Object
show all
Defined in:
lib/copypasta/entry/literal.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#filename

Instance Method Summary collapse

Methods inherited from Base

#apply

Constructor Details

#initialize(filename, data:, only_if: nil) ⇒ Literal



8
9
10
11
12
13
14
15
# File 'lib/copypasta/entry/literal.rb', line 8

def initialize(filename, data:, only_if: nil)
  raise "filename must be a string." unless filename.is_a?(String)
  raise "only_if must be null or a Proc." if !only_if.nil? && !only_if.is_a?(Proc)

  @filename = filename
  @data = data
  @only_if = only_if
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



6
7
8
# File 'lib/copypasta/entry/literal.rb', line 6

def data
  @data
end