Class: AtCoderFriends::Generator::PythonRef
- Inherits:
-
Base
- Object
- Base
- AtCoderFriends::Generator::PythonRef
- Includes:
- PythonRefConstants, ConstFragmentMixin, DeclFragmentMixin
- Defined in:
- lib/at_coder_friends/generator/python_ref.rb
Overview
generates Python source from problem description
Constant Summary collapse
- ACF_HOME =
File.realpath(File.join(__dir__, '..', '..', '..'))
- TMPL_DIR =
File.join(ACF_HOME, 'templates')
- TEMPLATE =
File.join(TMPL_DIR, 'python_ref.py.erb')
- FRAGMENTS =
File.realpath(File.join(TMPL_DIR, 'python_ref_fragments.yml'))
- ATTRS =
Attributes.new(:py, TEMPLATE, FRAGMENTS)
Constants included from PythonRefConstants
AtCoderFriends::Generator::PythonRefConstants::VERSION
Instance Method Summary collapse
- #attrs ⇒ Object
- #gen_consts ⇒ Object
-
#render(src) ⇒ Object
deprecated, use ERB syntax.
Instance Method Details
#attrs ⇒ Object
22 23 24 |
# File 'lib/at_coder_friends/generator/python_ref.rb', line 22 def attrs ATTRS end |
#gen_consts ⇒ Object
26 27 28 29 30 |
# File 'lib/at_coder_friends/generator/python_ref.rb', line 26 def gen_consts pbm.constants .select { |c| c.type == :mod } .map { |c| gen_const(c) } end |
#render(src) ⇒ Object
deprecated, use ERB syntax
33 34 35 36 |
# File 'lib/at_coder_friends/generator/python_ref.rb', line 33 def render(src) src = (src, '### CONSTS ###', gen_consts) (src, '### DCLS ###', gen_decls) end |