Class: Syntax::Respond

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#http_statusObject (readonly)

Returns the value of attribute http_status.



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

def http_status
  @http_status
end

#viewObject (readonly)

Returns the value of attribute view.



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

def view
  @view
end

Instance Method Details

#parseObject



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

def parse
  if elements.length > 0
    elements[0].elements[1].elements.each do |element|
      if element.is_a? View
        @view = element.parse
      end

      if element.is_a? HttpStatus
        @http_status = element.parse
      end
    end
  end

  self
end

#to_hashObject



21
22
23
# File 'lib/silicon/routing/syntax/respond.rb', line 21

def to_hash
  {view: @view, http_status: @http_status}
end