Skip to content

Commit

Permalink
Update calculation.rb
Browse files Browse the repository at this point in the history
  • Loading branch information
ntkme committed Jul 22, 2023
1 parent 53e0d33 commit 25688e0
Showing 1 changed file with 19 additions and 15 deletions.
34 changes: 19 additions & 15 deletions lib/sass/value/calculation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,9 @@ class Calculation
include Value
include CalculationValue

def initialize(name, arguments)
arguments.each(&:assert_calculation_value)

@name = name.freeze
@arguments = arguments.freeze
end

# @return [::String]
attr_reader :name

# @return [Array<CalculationValue>]
attr_reader :arguments

private_class_method :new

class << self
private :new

# @param argument [CalculationValue]
# @return [Calculation]
def calc(argument)
Expand Down Expand Up @@ -64,6 +51,23 @@ def valid_clamp_arg?(value)
end
end

protected

def initialize(name, arguments)
arguments.each(&:assert_calculation_value)

@name = name.freeze
@arguments = arguments.freeze
end

public

# @return [::String]
attr_reader :name

# @return [Array<CalculationValue>]
attr_reader :arguments

# @return [Calculation]
def assert_calculation(_name = nil)
self
Expand Down

0 comments on commit 25688e0

Please sign in to comment.