#!/usr/bin/ruby

# 객체

class Person
  def initialize(first_name, last_name, age)
    @first_name = first_name
    @last_name = last_name
    @age = age
  end

  def name
    "#{@first_name} #{@last_name}"
  end
end


steve = Person.new("Steve", "McQueen", 37)
puts steve.name


## Object

=begin

* kind_of?
* instance_of?
* instance_variable_defined?
* method
* methods
* nil?
* object_id
* private_methods
* protected_methods
* public_method
* public_methods
* singleton_class
* single_method
* singleton_methds
* define_singleton_method
* extend
* send
* public_send


* instance_variables
* remove_instance_variable






=end


=begin
* clone
* define_singleton_method
* display
* dup
* freeze
* itself


=end




## Struct

Customer = Struct.new("Customer", :name, :age, :address)
charlie = Customer.new('Charlie', 13, 'Seoul')
charlie.address = 'Busan'
p charlie.address

=begin
* to_h
* to_a
* to_s

* values

* each
* each_pair


=end



## Basic Object

class YetAnotherClass < BasicObject

end

## Singleton
require 'singleton'

class MyClass
  include Singleton
  def initialize
    @something = 'unknown'
  end
  def something
    @something
  end
  def something=(s)
    @something = s
  end
end


a = MyClass.instance
b = MyClass.instance
a.something = 'Awesome'
p b

END{
  # https://ruby-doc.org/3.3.0/Object.html
  # https://ruby-doc.org/3.3.0/Struct.html
  # https://ruby-doc.org/3.3.0/stdlibs/ostruct/OpenStruct.html
  # https://ruby-doc.org/3.3.0/BasicObject.html

  # https://ruby-doc.org/3.3.0/stdlibs/singleton/Singleton.html
}
