Class: AtCoderFriends::Generator::InputFormatFragment

Inherits:
FragmentBase
  • Object
show all
Defined in:
lib/at_coder_friends/generator/fragment.rb

Overview

base class for variable declaration generator

Instance Attribute Summary

Attributes inherited from FragmentBase

#templates

Instance Method Summary collapse

Methods inherited from FragmentBase

#initialize, #method_missing, #render, #respond_to_missing?, #to_s

Constructor Details

This class inherits a constructor from AtCoderFriends::Generator::FragmentBase

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class AtCoderFriends::Generator::FragmentBase

Instance Method Details

#componentsObject



99
100
101
102
103
# File 'lib/at_coder_friends/generator/fragment.rb', line 99

def components
  @components ||= super&.map do |cmp|
    self.class.new(cmp, templates)
  end
end

#delimsObject



83
84
85
# File 'lib/at_coder_friends/generator/fragment.rb', line 83

def delims
  delim.chars
end

#generateObject



62
63
64
# File 'lib/at_coder_friends/generator/fragment.rb', line 62

def generate
  render(:main)
end

#sz1Object Also known as: sz



74
75
76
# File 'lib/at_coder_friends/generator/fragment.rb', line 74

def sz1
  size[0]
end

#sz2Object



79
80
81
# File 'lib/at_coder_friends/generator/fragment.rb', line 79

def sz2
  size[1]
end

#vObject



70
71
72
# File 'lib/at_coder_friends/generator/fragment.rb', line 70

def v
  vs[0]
end

#varsObject



87
88
89
90
91
92
93
94
95
96
97
# File 'lib/at_coder_friends/generator/fragment.rb', line 87

def vars
  @vars ||= super.map do |v, item|
    var = Problem::InputFormat.new(
      container: container,
      names: [v],
      item: item,
      size: size
    )
    self.class.new(var, templates)
  end
end

#vsObject



66
67
68
# File 'lib/at_coder_friends/generator/fragment.rb', line 66

def vs
  names
end