U E D R , A S I H C RSS

Ruby Language/Class


1. �����

2. �� ��

3. 모듈

  • ������ ��는 �����
  • Class �����는 Module ����� �����
    • ����� = 모듈 + ������ 능�
  • ��능
    • Mix-in
    • Namespace

3.1. Mix-in

  • ����
    • Ruby는 �����만 �����.
      • 따� �����는 ���� ����.
      • �러� 모듈��러����받 ����.
  • Include : ������� 모듈 ����받는 ��.

3.2. Namespace

// 1
class Service
end

// 2
module Library
  class Service
  end
end
  • Service �����는 ���벨 namespace�� ����, 뒤 Service �����는 Library 모듈�� ������.
����는 � ���� ���
1� ��� ������ ����.
Service
�는
::Service

2 는 ��� ����.
Library::Service
Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:27:56
Processing time 0.0142 sec