Class: Syntax::Command

Inherits:
Treetop::Runtime::SyntaxNode
  • Object
show all
Defined in:
lib/silicon/routing/syntax/command.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/silicon/routing/syntax/command.rb', line 3

def name
  @name
end

#result_nameObject (readonly)

Returns the value of attribute result_name.



3
4
5
# File 'lib/silicon/routing/syntax/command.rb', line 3

def result_name
  @result_name
end

Instance Method Details

#async?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/silicon/routing/syntax/command.rb', line 24

def async?
  @is_async
end

#parallel?Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/silicon/routing/syntax/command.rb', line 28

def parallel?
  @is_parallel
end

#parseObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/silicon/routing/syntax/command.rb', line 5

def parse
  @is_async = text_value.start_with? '=*'
  @is_parallel = text_value.start_with? '=>'
  @is_sequential = text_value.start_with? '*>'

  full_name = text_value.sub('*>', '').sub('=*', '').sub('=>', '')

  if full_name.include? '@'
    parts = full_name.split('@')
    @result_name = parts[0]
    @name = parts[1]
  else
    @result_name = "#{full_name}_result"
    @name = full_name
  end

  self
end

#sequential?Boolean

Returns:

  • (Boolean)


32
33
34
# File 'lib/silicon/routing/syntax/command.rb', line 32

def sequential?
  @is_sequential
end