File: concrete-syntax/core/pattern/container/abstract.rb

Overview
Module Structure
Class Hierarchy
Code

Overview

Module Structure

  module: <Toplevel Module>
  module: Umu#6
  module: ConcreteSyntax#8
  module: Core#10
  module: Pattern#12
  module: Container#14
  class: Abstract#16
includes
  Enumerable ( Builtin-Module )
inherits from
  Abstract ( Umu::ConcreteSyntax::Core::Pattern )
has properties
attribute: array [R] #19
method: initialize / 2 #22
method: each #31
method: __gen_sym__ / 1 #40

Code

   1  # coding: utf-8
   2  # frozen_string_literal: true
   3 
   4 
   5 
   6  module Umu
   7 
   8  module ConcreteSyntax
   9 
  10  module Core
  11 
  12  module Pattern
  13 
  14  module Container
  15 
  16  class Abstract < Pattern::Abstract
  17      include Enumerable
  18 
  19      attr_reader :array
  20 
  21 
  22      def initialize(loc, array)
  23          ASSERT.kind_of array, ::Array
  24 
  25          super(loc)
  26 
  27          @array = array
  28      end
  29 
  30 
  31      def each
  32          self.array.each do |x|
  33              yield x
  34          end
  35      end
  36 
  37 
  38  private
  39 
  40      def __gen_sym__(num)
  41          ASSERT.kind_of num, ::Integer
  42 
  43          format("%%a%d", num).to_sym
  44      end
  45  end
  46 
  47  end # Umu::ConcreteSyntax::Core::Pattern::Container
  48 
  49  end # Umu::ConcreteSyntax::Core::Pattern
  50 
  51  end # Umu::ConcreteSyntax::Core
  52 
  53  end # Umu::ConcreteSyntax
  54 
  55  end # Umu