Suche senden
Hochladen
Ruby Class, Module, Self and Instance_eval Guide
•
0 gefällt mir
•
157 views
Durch KI verbesserter Titel
Jumpei Yokota
Folgen
メタプログラミング Ruby の輪読会 4 章までの復習と 5.1〜5.3 章の紹介。
Weniger lesen
Mehr lesen
Technologie
Melden
Teilen
Melden
Teilen
1 von 17
Jetzt herunterladen
Downloaden Sie, um offline zu lesen
Empfohlen
Effective PHP. Part 2
Effective PHP. Part 2
Vasily Kartashov
Effective PHP. Part 4
Effective PHP. Part 4
Vasily Kartashov
Effective PHP. Part 1
Effective PHP. Part 1
Vasily Kartashov
Effective PHP. Part 5
Effective PHP. Part 5
Vasily Kartashov
Effective PHP. Part 3
Effective PHP. Part 3
Vasily Kartashov
Effective PHP. Part 6
Effective PHP. Part 6
Vasily Kartashov
Os Welton
Os Welton
oscon2007
Write codeforhumans
Write codeforhumans
Narendran R
Empfohlen
Effective PHP. Part 2
Effective PHP. Part 2
Vasily Kartashov
Effective PHP. Part 4
Effective PHP. Part 4
Vasily Kartashov
Effective PHP. Part 1
Effective PHP. Part 1
Vasily Kartashov
Effective PHP. Part 5
Effective PHP. Part 5
Vasily Kartashov
Effective PHP. Part 3
Effective PHP. Part 3
Vasily Kartashov
Effective PHP. Part 6
Effective PHP. Part 6
Vasily Kartashov
Os Welton
Os Welton
oscon2007
Write codeforhumans
Write codeforhumans
Narendran R
Clean Code Principles
Clean Code Principles
YeurDreamin'
Clean code
Clean code
Knoldus Inc.
Dev Concepts: Functional Programming
Dev Concepts: Functional Programming
Svetlin Nakov
Some basic FP concepts
Some basic FP concepts
Falko Riemenschneider
Test in action week 4
Test in action week 4
Yi-Huan Chan
PhpSpec: practical introduction
PhpSpec: practical introduction
Dave Hulbert
Functions in php
Functions in php
Mudasir Syed
Test in action week 3
Test in action week 3
Yi-Huan Chan
php 2 Function creating, calling,PHP built-in function
php 2 Function creating, calling,PHP built-in function
tumetr1
Object Oriented PHP - PART-2
Object Oriented PHP - PART-2
Jalpesh Vasa
Introduction to Python decorators
Introduction to Python decorators
rikbyte
Functions in php
Functions in php
AbdulAzizSapra
Basic constructs i
Basic constructs i
Manjitsing Valvi
Test in action week 2
Test in action week 2
Yi-Huan Chan
Functional programing in Javascript (lite intro)
Functional programing in Javascript (lite intro)
Nikos Kalogridis
Arrays & functions in php
Arrays & functions in php
Ashish Chamoli
PHP Barcelona 2010 - Architecture and testability
PHP Barcelona 2010 - Architecture and testability
Giorgio Sironi
Java 8 by example!
Java 8 by example!
Mark Harrison
Functional programming
Functional programming
Kibru Demeke
Code generating beans in Java
Code generating beans in Java
Stephen Colebourne
Preparing for the next PHP version (5.6)
Preparing for the next PHP version (5.6)
Damien Seguy
Perl Teach-In (part 2)
Perl Teach-In (part 2)
Dave Cross
Weitere ähnliche Inhalte
Was ist angesagt?
Clean Code Principles
Clean Code Principles
YeurDreamin'
Clean code
Clean code
Knoldus Inc.
Dev Concepts: Functional Programming
Dev Concepts: Functional Programming
Svetlin Nakov
Some basic FP concepts
Some basic FP concepts
Falko Riemenschneider
Test in action week 4
Test in action week 4
Yi-Huan Chan
PhpSpec: practical introduction
PhpSpec: practical introduction
Dave Hulbert
Functions in php
Functions in php
Mudasir Syed
Test in action week 3
Test in action week 3
Yi-Huan Chan
php 2 Function creating, calling,PHP built-in function
php 2 Function creating, calling,PHP built-in function
tumetr1
Object Oriented PHP - PART-2
Object Oriented PHP - PART-2
Jalpesh Vasa
Introduction to Python decorators
Introduction to Python decorators
rikbyte
Functions in php
Functions in php
AbdulAzizSapra
Basic constructs i
Basic constructs i
Manjitsing Valvi
Test in action week 2
Test in action week 2
Yi-Huan Chan
Functional programing in Javascript (lite intro)
Functional programing in Javascript (lite intro)
Nikos Kalogridis
Arrays & functions in php
Arrays & functions in php
Ashish Chamoli
PHP Barcelona 2010 - Architecture and testability
PHP Barcelona 2010 - Architecture and testability
Giorgio Sironi
Java 8 by example!
Java 8 by example!
Mark Harrison
Functional programming
Functional programming
Kibru Demeke
Code generating beans in Java
Code generating beans in Java
Stephen Colebourne
Was ist angesagt?
(20)
Clean Code Principles
Clean Code Principles
Clean code
Clean code
Dev Concepts: Functional Programming
Dev Concepts: Functional Programming
Some basic FP concepts
Some basic FP concepts
Test in action week 4
Test in action week 4
PhpSpec: practical introduction
PhpSpec: practical introduction
Functions in php
Functions in php
Test in action week 3
Test in action week 3
php 2 Function creating, calling,PHP built-in function
php 2 Function creating, calling,PHP built-in function
Object Oriented PHP - PART-2
Object Oriented PHP - PART-2
Introduction to Python decorators
Introduction to Python decorators
Functions in php
Functions in php
Basic constructs i
Basic constructs i
Test in action week 2
Test in action week 2
Functional programing in Javascript (lite intro)
Functional programing in Javascript (lite intro)
Arrays & functions in php
Arrays & functions in php
PHP Barcelona 2010 - Architecture and testability
PHP Barcelona 2010 - Architecture and testability
Java 8 by example!
Java 8 by example!
Functional programming
Functional programming
Code generating beans in Java
Code generating beans in Java
Ähnlich wie Ruby Class, Module, Self and Instance_eval Guide
Preparing for the next PHP version (5.6)
Preparing for the next PHP version (5.6)
Damien Seguy
Perl Teach-In (part 2)
Perl Teach-In (part 2)
Dave Cross
Damien seguy php 5.6
Damien seguy php 5.6
Damien Seguy
Functional Javascript
Functional Javascript
guest4d57e6
Python fundamentals - basic | WeiYuan
Python fundamentals - basic | WeiYuan
Wei-Yuan Chang
PHP 5.3 Overview
PHP 5.3 Overview
jsmith92
Workshop quality assurance for php projects tek12
Workshop quality assurance for php projects tek12
Michelangelo van Dam
Lecture9_OOPHP_SPring2023.pptx
Lecture9_OOPHP_SPring2023.pptx
ShaimaaMohamedGalal
Ch8(oop)
Ch8(oop)
Chhom Karath
PHPUnit best practices presentation
PHPUnit best practices presentation
Thanh Robi
Write your Ruby in Style
Write your Ruby in Style
Bhavin Javia
QA for PHP projects
QA for PHP projects
Michelangelo van Dam
Quality assurance for php projects with PHPStorm
Quality assurance for php projects with PHPStorm
Michelangelo van Dam
The why and how of moving to PHP 5.4/5.5
The why and how of moving to PHP 5.4/5.5
Wim Godden
The why and how of moving to php 5.4
The why and how of moving to php 5.4
Wim Godden
Python lecture 8
Python lecture 8
Tanwir Zaman
Magic methods
Magic methods
Matthew Barlocker
The why and how of moving to php 5.4/5.5
The why and how of moving to php 5.4/5.5
Wim Godden
Quality Assurance for PHP projects - ZendCon 2012
Quality Assurance for PHP projects - ZendCon 2012
Michelangelo van Dam
Symfony2 - WebExpo 2010
Symfony2 - WebExpo 2010
Fabien Potencier
Ähnlich wie Ruby Class, Module, Self and Instance_eval Guide
(20)
Preparing for the next PHP version (5.6)
Preparing for the next PHP version (5.6)
Perl Teach-In (part 2)
Perl Teach-In (part 2)
Damien seguy php 5.6
Damien seguy php 5.6
Functional Javascript
Functional Javascript
Python fundamentals - basic | WeiYuan
Python fundamentals - basic | WeiYuan
PHP 5.3 Overview
PHP 5.3 Overview
Workshop quality assurance for php projects tek12
Workshop quality assurance for php projects tek12
Lecture9_OOPHP_SPring2023.pptx
Lecture9_OOPHP_SPring2023.pptx
Ch8(oop)
Ch8(oop)
PHPUnit best practices presentation
PHPUnit best practices presentation
Write your Ruby in Style
Write your Ruby in Style
QA for PHP projects
QA for PHP projects
Quality assurance for php projects with PHPStorm
Quality assurance for php projects with PHPStorm
The why and how of moving to PHP 5.4/5.5
The why and how of moving to PHP 5.4/5.5
The why and how of moving to php 5.4
The why and how of moving to php 5.4
Python lecture 8
Python lecture 8
Magic methods
Magic methods
The why and how of moving to php 5.4/5.5
The why and how of moving to php 5.4/5.5
Quality Assurance for PHP projects - ZendCon 2012
Quality Assurance for PHP projects - ZendCon 2012
Symfony2 - WebExpo 2010
Symfony2 - WebExpo 2010
Kürzlich hochgeladen
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Drew Madelung
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Neo4j
🐬 The future of MySQL is Postgres 🐘
🐬 The future of MySQL is Postgres 🐘
RTylerCroy
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
V3cube
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
Enterprise Knowledge
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
debabhi2
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
Anna Loughnan Colquhoun
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Miguel Araújo
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
Rafal Los
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
wesley chun
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
Paola De la Torre
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
The Digital Insurer
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
Delhi Call girls
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
Results
How to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
naman860154
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
Delhi Call girls
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
ThousandEyes
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
Principled Technologies
Kürzlich hochgeladen
(20)
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
🐬 The future of MySQL is Postgres 🐘
🐬 The future of MySQL is Postgres 🐘
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
How to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
Ruby Class, Module, Self and Instance_eval Guide
1.
RUBY § 1-4 ,
§ 5.1-5.3 Jumpei Yokota @IPROS Corp. 1
2.
§ 1-4 2
3.
➤ ➤ obj.class #
=> Greetin ➤ ➤ obj.class.instance_methods(false) # => [:welcome] ➤ ➤ obj.instance_variables # => [:@text] 3
4.
➤ include ➤ ➤ ➤ Ruby
4
5.
➤ Refinements ➤ module
StringExtentions; refine String do; def … ➤ ➤ Object#send obj.send(my_method, 3) ➤ Module#define_method ➤ method_missing ➤ class String; def method_missing(method, *args)… 5
6.
➤ ➤ my_method {|x|
“x + y”} ➤ Kernel#block_given? ➤ ➤ 6
7.
instance_eval ➤ ➤ BasicObject#instance_eval ➤ → 7
8.
➤ Proc ➤ ➤ & ➤
lambda ➤ return lambda Proc Proc ➤ ➤ ➤ Object#method ➤ Object#call ➤ Method#to_proc ⇔ Module#define_method 8
9.
§ 5 9
10.
➤ Ruby → self ➤
self ➤ self self main Object 10
11.
obj D → D C 11
12.
CLASS_EVAL ➤ Module#class_eval 12
13.
self obj obj 2 MyClass 13
14.
CLASS_EVAL ➤ ➤ Loan to_s
def to_s # initialize @time = Time.now “#{@book.upcase} loaned on #{@time}” end ➤ ➤ @time = Loan.time_class.now ➤ def self.time_class @time_class || Time # @time_class = nil → end ➤ @time_class FakeTime Loan.instance_eval { @time_class = FakeTime } 14
15.
➤ ➤ String str
title? ➤ Object#define_singleton_method 15
16.
➤ self.hoge 16
17.
➤ Ruby ➤ ➤ Module#attr_ ➤
Module#attr_reader ➤ Module#attr_writer ➤ Module#attr_accessor 17
Jetzt herunterladen