Class: AtCoderFriends::Generator::RubyBuiltin
- Includes:
- ConstFragmentMixin, DeclFragmentMixin
- Defined in:
- lib/at_coder_friends/generator/ruby_builtin.rb
Overview
generates Ruby 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, 'ruby_builtin.rb.erb')
- FRAGMENTS =
File.realpath(File.join(TMPL_DIR, 'ruby_builtin_fragments.yml'))
- ATTRS =
Attributes.new(:rb, TEMPLATE, FRAGMENTS)
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #attrs ⇒ Object
- #gen_consts ⇒ Object
-
#render(src) ⇒ Object
deprecated, use ERB syntax.
Methods included from DeclFragmentMixin
Methods included from ConstFragmentMixin
Methods inherited from Base
#config_file_ext, #config_fragments, #config_template, #embed_lines, #fragments, #generate, #initialize, #process
Constructor Details
This class inherits a constructor from AtCoderFriends::Generator::Base
Instance Method Details
#attrs ⇒ Object
16 17 18 |
# File 'lib/at_coder_friends/generator/ruby_builtin.rb', line 16 def attrs ATTRS end |
#gen_consts ⇒ Object
20 21 22 23 24 |
# File 'lib/at_coder_friends/generator/ruby_builtin.rb', line 20 def gen_consts pbm.constants .select { |c| c.type == :mod } .map { |c| gen_const(c) } end |
#render(src) ⇒ Object
deprecated, use ERB syntax
27 28 29 30 |
# File 'lib/at_coder_friends/generator/ruby_builtin.rb', line 27 def render(src) src = (src, '### CONSTS ###', gen_consts) (src, '### DCLS ###', gen_decls) end |