Module: Pythonism::Pythonize::Statement
- Defined in:
- lib/pythonism/pythonize/statement.rb
Overview
Support Python-like statement
Instance Method Summary collapse
-
#import(obj) ⇒ Boolean
method of imitation
importstatement. -
#this ⇒ Symbol
special keyword for Zen.
Instance Method Details
#import(obj) ⇒ Boolean
method of imitation import statement
5 6 7 8 9 10 11 12 13 |
# File 'lib/pythonism/pythonize/statement.rb', line 5 def import(obj) case obj when :this puts Pythonism::ZEN_OF_PYTHON nil else require obj.to_s end end |
#this ⇒ Symbol
special keyword for Zen
17 18 19 20 21 22 23 24 |
# File 'lib/pythonism/pythonize/statement.rb', line 17 def this case inspect when 'main' :this else raise NameError, "name 'this' is not defined" end end |