Class: PictureTag::Instructions::Instruction

Inherits:
Object
  • Object
show all
Defined in:
lib/jekyll_picture_tag/instructions.rb

Overview

Generic instruction, meant to be inherited. Children of this class must override the source method, and likely want to override valid?, coerce, and error_message as applicable.

Instance Method Summary collapse

Instance Method Details

#valueObject

Memoized value of the given instruction. This is the public API.

Raises:

  • (ArgumentError)


18
19
20
21
22
23
24
# File 'lib/jekyll_picture_tag/instructions.rb', line 18

def value
  return @value if defined?(@value)

  raise ArgumentError, error_message unless valid?

  @value = coerced
end