Class: Ryac::Pipeline::MinifiedResult

Inherits:
Data
  • Object
show all
Defined in:
lib/ryac/pipeline/data_types.rb,
sig/ryac/pipeline/data_types.rbs

Overview

Final output of the pipeline.

content is the assembled runnable program: stdlib requires, then the preamble, then the minified code. preamble is a slice of content carried separately so callers that split output can identify it — never something to append to content again. aliases are the one part kept out: optional compatibility shims, attached by full_content or written to their own file.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(content:, aliases: '', preamble: '', stats:) ⇒ MinifiedResult

steep:ignore UndeclaredMethodDefinition

Parameters:

  • content: (String)
  • aliases: (String) (defaults to: '')
  • preamble: (String) (defaults to: '')
  • stats: (CompressionStats)


176
177
178
# File 'lib/ryac/pipeline/data_types.rb', line 176

def initialize(content:, aliases: '', preamble: '', stats:) # steep:ignore UndeclaredMethodDefinition
  super
end

Instance Attribute Details

#aliases ⇒ Object (readonly)

Returns the value of attribute aliases

Returns:

  • (Object) —

    the current value of aliases



170
171
172
# File 'lib/ryac/pipeline/data_types.rb', line 170

def aliases
  @aliases
end

#content ⇒ Object (readonly)

Returns the value of attribute content

Returns:

  • (Object) —

    the current value of content



170
171
172
# File 'lib/ryac/pipeline/data_types.rb', line 170

def content
  @content
end

#preamble ⇒ Object (readonly)

Returns the value of attribute preamble

Returns:

  • (Object) —

    the current value of preamble



170
171
172
# File 'lib/ryac/pipeline/data_types.rb', line 170

def preamble
  @preamble
end

#stats ⇒ Object (readonly)

Returns the value of attribute stats

Returns:

  • (Object) —

    the current value of stats



170
171
172
# File 'lib/ryac/pipeline/data_types.rb', line 170

def stats
  @stats
end

Class Method Details

.new ⇒ MinifiedResult

Parameters:

  • content: (String)
  • aliases: (String)
  • preamble: (String)
  • stats: (CompressionStats)

Returns:



149
# File 'sig/ryac/pipeline/data_types.rbs', line 149

def self.new: (content: String, ?aliases: String, ?preamble: String, stats: CompressionStats) -> MinifiedResult

Instance Method Details

#full_content ⇒ String

The program with its alias shims attached — what a caller runs when not splitting the aliases into a separate file.

Returns:

  • (String)


182
183
184
# File 'lib/ryac/pipeline/data_types.rb', line 182

def full_content # steep:ignore UndeclaredMethodDefinition
  aliases.empty? ? content : "#{content};#{aliases}" # steep:ignore NoMethod
end