Class: CssColorContrast::CommandInterpreter::Function
- Inherits:
-
Object
- Object
- CssColorContrast::CommandInterpreter::Function
- Defined in:
- lib/css_color_contrast/command_interpreter.rb
Direct Known Subclasses
Defined Under Namespace
Classes: AdjustLightness, AssignVariable, Info, Ratio
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name, env = {}) ⇒ Function
constructor
A new instance of Function.
- #param_values ⇒ Object
- #push(param) ⇒ Object
Constructor Details
#initialize(name, env = {}) ⇒ Function
Returns a new instance of Function.
39 40 41 42 43 |
# File 'lib/css_color_contrast/command_interpreter.rb', line 39 def initialize(name, env = {}) @name = name @env = env @params = [] end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
37 38 39 |
# File 'lib/css_color_contrast/command_interpreter.rb', line 37 def name @name end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
37 38 39 |
# File 'lib/css_color_contrast/command_interpreter.rb', line 37 def params @params end |
Class Method Details
.create(name, env = {}) ⇒ Object
117 118 119 120 121 |
# File 'lib/css_color_contrast/command_interpreter.rb', line 117 def self.create(name, env = {}) return AssignVariable.new(name, env) if name.start_with?('@') FUNCTION_TABLE[name].new(name, env) end |
Instance Method Details
#param_values ⇒ Object
49 50 51 |
# File 'lib/css_color_contrast/command_interpreter.rb', line 49 def param_values @params.map(&:evaluate).flatten end |
#push(param) ⇒ Object
45 46 47 |
# File 'lib/css_color_contrast/command_interpreter.rb', line 45 def push(param) @params.push(param) end |