Class: Copypasta::Entry::Literal
- Defined in:
- lib/copypasta/entry/literal.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(filename, data:, only_if: nil) ⇒ Literal
constructor
A new instance of Literal.
Methods inherited from Base
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
#data ⇒ Object (readonly)
Returns the value of attribute data.
6 7 8 |
# File 'lib/copypasta/entry/literal.rb', line 6 def data @data end |