Class: PHP::Block

Inherits:
PHP::Expression show all
Defined in:
lib/php/syntax/block.rb

Overview

See Also:

Class Method Summary

Instance Method Summary

Methods inherited from PHP::Node

#<<, #<=>, #children?, #each, #indent, #indent=, #initialize, #to_s

Constructor Details

This class inherits a constructor from PHP::Node

Class Method Details

+ (Block) for(expression)

Returns the given expression wrapped into a Block node; unless it already is a Block, in which case it is returned as-is.

Parameters:

Returns:



11
12
13
14
15
16
17
# File 'lib/php/syntax/block.rb', line 11

def self.for(expression)
  case expression
    when nil   then nil
    when Block then expression
    else Block.new(expression)
  end
end

Instance Method Details

- (String) to_php

Returns the PHP representation of this block.

Returns:

  • (String)


23
24
25
# File 'lib/php/syntax/block.rb', line 23

def to_php
  children.map(&:to_php).join('; ') << ';' # FIXME
end