Class: Solid::Arguments

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/solid/arguments.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(string) ⇒ Arguments

Returns a new instance of Arguments.



12
13
14
# File 'lib/solid/arguments.rb', line 12

def initialize(string)
  @string = string
end

Instance Attribute Details

#valuesObject

Returns the value of attribute values.



10
11
12
# File 'lib/solid/arguments.rb', line 10

def values
  @values
end

Class Method Details

.parse(string) ⇒ Object



6
7
8
# File 'lib/solid/arguments.rb', line 6

def self.parse(string)
  new("[#{string}]").parse!
end

Instance Method Details

#each(*args, &block) ⇒ Object



21
22
23
# File 'lib/solid/arguments.rb', line 21

def each(*args, &block)
  values.each(*args, &block)
end

#interpolate(context) ⇒ Object



25
26
27
# File 'lib/solid/arguments.rb', line 25

def interpolate(context)
  values.evaluate(context)
end

#parse!Object



16
17
18
19
# File 'lib/solid/arguments.rb', line 16

def parse!
  self.values = Solid::Parser.parse(@string)
  self
end