Class: Procreate::Swatches::Parser
- Inherits:
-
Object
- Object
- Procreate::Swatches::Parser
- Includes:
- CallableClass, ColorsHelper
- Defined in:
- lib/procreate/swatches/parser.rb
Overview
The class that handles the parsing of a .swatches
file to an instance of Wrapper.
Constant Summary
Constants included from ColorsHelper
ColorsHelper::SELECTED_KEYS, ColorsHelper::SWATCHES_ALPHA, ColorsHelper::SWATCHES_COLOR_SPACE, ColorsHelper::SWATCHES_MAX_SIZE
Instance Attribute Summary collapse
-
#file_path ⇒ Object
readonly
Returns the value of attribute file_path.
-
#wrapper ⇒ Object
readonly
Returns the value of attribute wrapper.
Class Method Summary collapse
-
.call ⇒ Object
Creates a new instance of Parser and calls #call Dynamically included by using CallableClass gem.
Instance Method Summary collapse
-
#call ⇒ Procreate::Swatches::Wrapper
Process the provided
.swatches
file and wrap the content in a Wrapper. -
#initialize(file_path) ⇒ Parser
constructor
Initialize a new instance of Parser.
Methods included from ColorsHelper
#prepare_color_for_push, #to_chroma_hsv, #to_color_json, #to_swatches_json
Constructor Details
#initialize(file_path) ⇒ Parser
Initialize a new instance of Procreate::Swatches::Parser
35 36 37 38 39 |
# File 'lib/procreate/swatches/parser.rb', line 35 def initialize(file_path) @file_path = file_path validate! end |
Instance Attribute Details
#file_path ⇒ Object (readonly)
Returns the value of attribute file_path.
25 26 27 |
# File 'lib/procreate/swatches/parser.rb', line 25 def file_path @file_path end |
#wrapper ⇒ Object (readonly)
Returns the value of attribute wrapper.
21 22 23 |
# File 'lib/procreate/swatches/parser.rb', line 21 def wrapper @wrapper end |
Class Method Details
.call ⇒ Object
Creates a new instance of Procreate::Swatches::Parser and calls #call Dynamically included by using CallableClass gem.
|
# File 'lib/procreate/swatches/parser.rb', line 15
|
Instance Method Details
#call ⇒ Procreate::Swatches::Wrapper
Process the provided .swatches
file and wrap the content in a Wrapper
47 48 49 50 |
# File 'lib/procreate/swatches/parser.rb', line 47 def call unzip wrap_colors end |