This document provides an overview of key concepts in Ruby including variables, methods, classes, modules, inheritance and scope. It discusses local variables, instance variables, class variables and global variables. It explains how methods are defined and called in Ruby. It describes classes and modules, and how modules can be mixed into classes. The document also covers inheritance, constants, self, and singleton methods. It provides details on variable scope and how Ruby determines an identifier is a variable, keyword or method call.
A Internet das Coisas (IoT - Internet of Things) é um conceito tecnológico que vem revolucionando a forma como interagimos com o mundo ao nosso redor. A IoT refere-se à interconexão de dispositivos físicos com a internet, permitindo que eles se comuniquem e coletem dados de forma contínua e automatizada. Esses dispositivos podem ser desde simples sensores até objetos complexos, como veículos, eletrodomésticos, wearables e até mesmo cidades inteiras.
A essência da IoT está na capacidade dos dispositivos de coletar e compartilhar dados através de redes sem fio, proporcionando uma inteligência distribuída e conectada. Esses dispositivos são equipados com sensores, atuadores e tecnologias de comunicação, permitindo que eles se conectem uns aos outros e com sistemas de computadores para trocar informações e realizar ações com base nesses dados.
Um dos principais benefícios da IoT é a coleta de dados em tempo real. Os dispositivos conectados são capazes de monitorar e capturar informações sobre seu ambiente, como temperatura, umidade, movimento, localização e muito mais. Esses dados são transmitidos para sistemas de processamento e análise, onde podem ser utilizados para tomada de decisões, otimização de processos, detecção de anomalias, previsão de eventos e até mesmo para a criação de novos serviços e experiências.
A IoT tem o potencial de impactar uma ampla gama de setores e segmentos da sociedade. Na agricultura, por exemplo, sensores podem ser instalados em plantações para monitorar a umidade do solo e a necessidade de irrigação, permitindo uma agricultura mais eficiente e sustentável. Na área da saúde, dispositivos vestíveis podem coletar dados sobre a atividade física, frequência cardíaca e padrões de sono, ajudando as pessoas a manterem um estilo de vida saudável e permitindo que profissionais de saúde monitorem pacientes de forma remota.
Além disso, a IoT pode trazer inovações para as cidades, transformando-as em cidades inteligentes. Sensores espalhados pela cidade podem monitorar o tráfego, os níveis de poluição, a iluminação pública e outros aspectos urbanos, permitindo uma gestão mais eficiente e sustentável dos recursos e serviços públicos. A IoT também tem potencial para impulsionar a indústria, através da automação de processos e do monitoramento em tempo real de máquinas e equipamentos, aumentando a eficiência e a produtividade.No entanto, a IoT também traz desafios e questões a serem consideradas. A segurança é uma das principais preocupações, já que dispositivos conectados podem se tornar alvos de ataques cibernéticos. A privacidade dos dados também é uma questão importante, uma vez que a coleta massiva de informações pode levantar preocupações sobre o uso indevido ou não autorizado desses dados. Além disso, a interoperabilidade entre diferentes dispositivos e sistemas é um desafio, já que a IoT envolve uma grande variedade de tecnologias e protocolos.
Para impulsionar o desenvolvimento da IoT, empresas e pesquisadores estão tr
Conversational Artificial Intelligence with Ben Tomlinson and Wayne ThompsonDatabricks
Communicating information to each other is at the heart of the human experience. Data, and the analysis of it, often drives this communication in a business setting. This session aims to give you an understanding of how advances in Artificial Intelligence, specifically Natural Language Interaction (NLI), Natural Language Generation coupled with Deep Learning can create new and exciting opportunities for building analytical based chatbots.
We will talk about how to design and train an NLI system that map requests to deep learning pipelines to derive insights. You will also learn how to apply NLG templates to help facilitate improved understanding and interaction with the chat-bot.
An introduction to Dialogflow (API.AI) for the class of Pervasive Systems of University of Rome - La Sapienza, Master Degree in Computer Engineering.
Demo: https://github.com/lucamaiano/pervasive-agent
A Internet das Coisas (IoT - Internet of Things) é um conceito tecnológico que vem revolucionando a forma como interagimos com o mundo ao nosso redor. A IoT refere-se à interconexão de dispositivos físicos com a internet, permitindo que eles se comuniquem e coletem dados de forma contínua e automatizada. Esses dispositivos podem ser desde simples sensores até objetos complexos, como veículos, eletrodomésticos, wearables e até mesmo cidades inteiras.
A essência da IoT está na capacidade dos dispositivos de coletar e compartilhar dados através de redes sem fio, proporcionando uma inteligência distribuída e conectada. Esses dispositivos são equipados com sensores, atuadores e tecnologias de comunicação, permitindo que eles se conectem uns aos outros e com sistemas de computadores para trocar informações e realizar ações com base nesses dados.
Um dos principais benefícios da IoT é a coleta de dados em tempo real. Os dispositivos conectados são capazes de monitorar e capturar informações sobre seu ambiente, como temperatura, umidade, movimento, localização e muito mais. Esses dados são transmitidos para sistemas de processamento e análise, onde podem ser utilizados para tomada de decisões, otimização de processos, detecção de anomalias, previsão de eventos e até mesmo para a criação de novos serviços e experiências.
A IoT tem o potencial de impactar uma ampla gama de setores e segmentos da sociedade. Na agricultura, por exemplo, sensores podem ser instalados em plantações para monitorar a umidade do solo e a necessidade de irrigação, permitindo uma agricultura mais eficiente e sustentável. Na área da saúde, dispositivos vestíveis podem coletar dados sobre a atividade física, frequência cardíaca e padrões de sono, ajudando as pessoas a manterem um estilo de vida saudável e permitindo que profissionais de saúde monitorem pacientes de forma remota.
Além disso, a IoT pode trazer inovações para as cidades, transformando-as em cidades inteligentes. Sensores espalhados pela cidade podem monitorar o tráfego, os níveis de poluição, a iluminação pública e outros aspectos urbanos, permitindo uma gestão mais eficiente e sustentável dos recursos e serviços públicos. A IoT também tem potencial para impulsionar a indústria, através da automação de processos e do monitoramento em tempo real de máquinas e equipamentos, aumentando a eficiência e a produtividade.No entanto, a IoT também traz desafios e questões a serem consideradas. A segurança é uma das principais preocupações, já que dispositivos conectados podem se tornar alvos de ataques cibernéticos. A privacidade dos dados também é uma questão importante, uma vez que a coleta massiva de informações pode levantar preocupações sobre o uso indevido ou não autorizado desses dados. Além disso, a interoperabilidade entre diferentes dispositivos e sistemas é um desafio, já que a IoT envolve uma grande variedade de tecnologias e protocolos.
Para impulsionar o desenvolvimento da IoT, empresas e pesquisadores estão tr
Conversational Artificial Intelligence with Ben Tomlinson and Wayne ThompsonDatabricks
Communicating information to each other is at the heart of the human experience. Data, and the analysis of it, often drives this communication in a business setting. This session aims to give you an understanding of how advances in Artificial Intelligence, specifically Natural Language Interaction (NLI), Natural Language Generation coupled with Deep Learning can create new and exciting opportunities for building analytical based chatbots.
We will talk about how to design and train an NLI system that map requests to deep learning pipelines to derive insights. You will also learn how to apply NLG templates to help facilitate improved understanding and interaction with the chat-bot.
An introduction to Dialogflow (API.AI) for the class of Pervasive Systems of University of Rome - La Sapienza, Master Degree in Computer Engineering.
Demo: https://github.com/lucamaiano/pervasive-agent
LUCID Vision Labs -All-in-One Industrial Edge Computing with the Triton Edge ...ClearView Imaging
Industrial camera manufacturers are constantly challenged to design smaller and more power efficient products, and at the same time increase their overall performance.
Cameras have become smarter offering machine learning capabilities to deploy trained machine learning models in order to automatically classify, detect, or segment features of
objects faster and more accurately than humans can. LUCID’s Triton Edge camera featuring Xilinx’s Zynq UltraScale+™ MPSoC provides a new level of on-camera performance and flexibility without sacrificing power efficiency, sensor performance, or
camera size. Learn about how you can jump start your vision application by reducing overall size, cutting manufacturing costs, and saving development time, while providing more value to your end-users.
It's the latest buzz word in the world of technology and everybody is talking about them. But what are chatbots really? What do they do apart from...ummm, chatting? And why is every other company suddenly jumping on to the chatbot bandwagon?
If you've been wondering about this new trend, you're not alone. Allow us to guide you through this exciting new world...
Artificial Intelligence has unleashed a wave of innovation, from effortlessly summarizing
articles to engaging in deep, thought-provoking conversations — with large language
models taking on the primary workload.
Enter the extraordinary realm of large language models (LLMs), the brainchild of deep
learning algorithms. These powerhouses not only decipher and grasp massive amounts
of data but also possess the uncanny ability to recognize, summarize, translate, predict,
and even generate a diverse range of textual and coding content.
Apache Pig is a high-level platform for creating programs that runs on Apache Hadoop. The language for this platform is called Pig Latin. Pig can execute its Hadoop jobs in MapReduce, Apache Tez, or Apache Spark.
Automated Question Paper Generator Project PresentationAnik Chakrabortty
A Web Application that automate the whole process of generating question papers in educational institutes.
Created By: Anik Kumar Chakrabortty, Md Yousuf, Iqbal Hossain Riaz
This presentation slides were created for ENG1021 - English For Engineers course assignment of Department of Computer Science & Engineering, Southeast University
Build an LLM-powered application using LangChain.pdfAnastasiaSteele10
LangChain is an advanced framework that allows developers to create language model-powered applications. It provides a set of tools, components, and interfaces that make building LLM-based applications easier. With LangChain, managing interactions with language models, chaining together various components, and integrating resources like APIs and databases is a breeze. The platform includes a set of APIs that can be integrated into applications, allowing developers to add language processing capabilities without having to start from scratch.
Advanced Ruby Idioms So Clean You Can Eat Off Of ThemBrian Guthrie
Look, you're going to go write a bunch of weird, crazy, and quite possibly criminally insane code in Ruby at some point or another in your career. Maybe you already have. I can't stop you, and I'd be disappointed if you didn't at least try, so in this talk I'll show you how to do it without poking your own eye out with the pointy end of a sharpened stick.
LUCID Vision Labs -All-in-One Industrial Edge Computing with the Triton Edge ...ClearView Imaging
Industrial camera manufacturers are constantly challenged to design smaller and more power efficient products, and at the same time increase their overall performance.
Cameras have become smarter offering machine learning capabilities to deploy trained machine learning models in order to automatically classify, detect, or segment features of
objects faster and more accurately than humans can. LUCID’s Triton Edge camera featuring Xilinx’s Zynq UltraScale+™ MPSoC provides a new level of on-camera performance and flexibility without sacrificing power efficiency, sensor performance, or
camera size. Learn about how you can jump start your vision application by reducing overall size, cutting manufacturing costs, and saving development time, while providing more value to your end-users.
It's the latest buzz word in the world of technology and everybody is talking about them. But what are chatbots really? What do they do apart from...ummm, chatting? And why is every other company suddenly jumping on to the chatbot bandwagon?
If you've been wondering about this new trend, you're not alone. Allow us to guide you through this exciting new world...
Artificial Intelligence has unleashed a wave of innovation, from effortlessly summarizing
articles to engaging in deep, thought-provoking conversations — with large language
models taking on the primary workload.
Enter the extraordinary realm of large language models (LLMs), the brainchild of deep
learning algorithms. These powerhouses not only decipher and grasp massive amounts
of data but also possess the uncanny ability to recognize, summarize, translate, predict,
and even generate a diverse range of textual and coding content.
Apache Pig is a high-level platform for creating programs that runs on Apache Hadoop. The language for this platform is called Pig Latin. Pig can execute its Hadoop jobs in MapReduce, Apache Tez, or Apache Spark.
Automated Question Paper Generator Project PresentationAnik Chakrabortty
A Web Application that automate the whole process of generating question papers in educational institutes.
Created By: Anik Kumar Chakrabortty, Md Yousuf, Iqbal Hossain Riaz
This presentation slides were created for ENG1021 - English For Engineers course assignment of Department of Computer Science & Engineering, Southeast University
Build an LLM-powered application using LangChain.pdfAnastasiaSteele10
LangChain is an advanced framework that allows developers to create language model-powered applications. It provides a set of tools, components, and interfaces that make building LLM-based applications easier. With LangChain, managing interactions with language models, chaining together various components, and integrating resources like APIs and databases is a breeze. The platform includes a set of APIs that can be integrated into applications, allowing developers to add language processing capabilities without having to start from scratch.
Advanced Ruby Idioms So Clean You Can Eat Off Of ThemBrian Guthrie
Look, you're going to go write a bunch of weird, crazy, and quite possibly criminally insane code in Ruby at some point or another in your career. Maybe you already have. I can't stop you, and I'd be disappointed if you didn't at least try, so in this talk I'll show you how to do it without poking your own eye out with the pointy end of a sharpened stick.
«Работа с базами данных с использованием Sequel»Olga Lavrentieva
Сергей Нартымов (Software Engineer в Transinet GmbH, г.Минск)
Доклад: «Работа с базами данных с использованием Sequel»
О чём: Ruby библиотека для работы с базами данных Sequel представляет собой легковесную альтернативу более популярной Active Record. Sequel лежит в основе работы с SQL базами данных в ROM (Ruby Object Mapper) - развивающемся ORM для Ruby, реализующим паттерн Data Mapper. В докладе будут рассмотрены различные аспекты использования Sequel, в том числе показаны примеры использования некоторых возможностей PostgreSQL с помощью Sequel.
Ruby is an object-oriented programming language; that much, everyone knows. But Ruby's objects work very differently from many other languages, especially if you're coming from a complied, statically typed language. In this lecture, I'll review the surprisingly simple rules that govern Ruby's objects. I discuss methods, classes, instances, and modules, and how these various pieces fit together into an integrated whole -- including such topics as inheritance, instance variables, class variables, mixins, and "include" vs. "extend".
A talk presented in RubyConf India 2010 at Bangalore, India. It revisits the role of objects and classes in Ruby OOP, and encourages programmers to discover a new approach to OOP.
Основные понятия связанные с разработкой ПО: просто о сложном. Лаабе Дмитрий.IT-Доминанта
Основные понятия связанные с разработкой ПО: просто о сложном.
Лаабе Дмитрий
Генеральный директор и основатель IT-Доминанта, Технический директор, программист портала Айти-Событие.рф", Санкт-Петербург.
Object-Oriented BDD w/ Cucumber by Matt van HornSolano Labs
Here are the slides that Matt van Horn from New Relic presented at last night's Automated Testing San Francisco meetup, hosted by Constant Contact. This presentation briefly covers continuous integration at New Relic, and then dives deeper into Object-Oriented BDD with Cucumber. We thank Matt for the great presentation.
Please feel free to connect with Matt on Github or Twitter:
github.com/mattvanhorn
or
@nycplayer
http://www.meetup.com/Automated-Testing-San-Francisco/
This is Part 1 of a two-lecture series on implementing HTML. I created this lecture in an effort to keep my design students from "fearing the code" they encounter in an introductory level course to Dreamweaver and Web Site design.
One of the advantages of learning a new language is being exposed to new idioms and new approaches to solving old problems. In this talk, we will introduce the Ruby language with particular focus on the idioms and concepts that are different from what is found in Java.
We will introduce concepts such as closures, continuations and meta programming. We will also examine powerful techniques that are practically impossible in Java due to its compile time binding of types.
No experience with Ruby is assumed although an understanding of Java would be helpful.
This talk was given at the Toronto Java Users Group in April 2008
Ruby object model - Understanding of object play role for rubyTushar Pal
This is including the Ruby Object Model Detail In which It consist a Hierarchy of Ruby Object.
This PPT Basically will solve Which Class is having which methods ?
Which Module are included or excluded ?
How a Class Work?
Role of Self?
Use of Instance ,Class Variable and Methods
Object-Oriented Thinking- A way of viewing world – Agents and Communities, messages and methods, Responsibilities, Classes and Instances, Class Hierarchies- Inheritance, Method binding, Overriding and Exceptions, Summary of Object-Oriented concepts. Java buzzwords, An Overview of Java, Data types, Variables and Arrays, operators, expressions, control statements, Introducing classes, Methods and Classes, String handling.
Inheritance– Inheritance concept, Inheritance basics, Member access, Constructors, Creating Multilevel hierarchy, super uses, using final with inheritance, Polymorphism-ad hoc polymorphism, pure polymorphism, method overriding, abstract classes, Object class, forms of inheritance specialization, specification, construction, extension, limitation, combination, benefits of inheritance, costs of inheritance
Object-oriented programming (OOP) is a paradigm in programming centered around the concept of "objects." In Python, OOP allows you to create and organize code using classes and objects, enabling you to structure your programs more efficiently, manage complexity, and promote code reusability.The concept of bundling data (attributes) and the methods that work on the data within a single unit (a class). It restricts direct access to some of the object's components and hides the internal state.Focusing on essential features by hiding complex implementation details. It enables working with objects at a higher level of abstraction without worrying about internal complexities.
Python's object-oriented programming provides a powerful way to structure code, promote code reuse, and build more modular and maintainable applications by leveraging these concepts effectively.
Epistemic Interaction - tuning interfaces to provide information for AI supportAlan Dix
Paper presented at SYNERGY workshop at AVI 2024, Genoa, Italy. 3rd June 2024
https://alandix.com/academic/papers/synergy2024-epistemic/
As machine learning integrates deeper into human-computer interactions, the concept of epistemic interaction emerges, aiming to refine these interactions to enhance system adaptability. This approach encourages minor, intentional adjustments in user behaviour to enrich the data available for system learning. This paper introduces epistemic interaction within the context of human-system communication, illustrating how deliberate interaction design can improve system understanding and adaptation. Through concrete examples, we demonstrate the potential of epistemic interaction to significantly advance human-computer interaction by leveraging intuitive human communication strategies to inform system design and functionality, offering a novel pathway for enriching user-system engagements.
DevOps and Testing slides at DASA ConnectKari Kakkonen
My and Rik Marselis slides at 30.5.2024 DASA Connect conference. We discuss about what is testing, then what is agile testing and finally what is Testing in DevOps. Finally we had lovely workshop with the participants trying to find out different ways to think about quality and testing in different parts of the DevOps infinity loop.
Essentials of Automations: Optimizing FME Workflows with ParametersSafe Software
Are you looking to streamline your workflows and boost your projects’ efficiency? Do you find yourself searching for ways to add flexibility and control over your FME workflows? If so, you’re in the right place.
Join us for an insightful dive into the world of FME parameters, a critical element in optimizing workflow efficiency. This webinar marks the beginning of our three-part “Essentials of Automation” series. This first webinar is designed to equip you with the knowledge and skills to utilize parameters effectively: enhancing the flexibility, maintainability, and user control of your FME projects.
Here’s what you’ll gain:
- Essentials of FME Parameters: Understand the pivotal role of parameters, including Reader/Writer, Transformer, User, and FME Flow categories. Discover how they are the key to unlocking automation and optimization within your workflows.
- Practical Applications in FME Form: Delve into key user parameter types including choice, connections, and file URLs. Allow users to control how a workflow runs, making your workflows more reusable. Learn to import values and deliver the best user experience for your workflows while enhancing accuracy.
- Optimization Strategies in FME Flow: Explore the creation and strategic deployment of parameters in FME Flow, including the use of deployment and geometry parameters, to maximize workflow efficiency.
- Pro Tips for Success: Gain insights on parameterizing connections and leveraging new features like Conditional Visibility for clarity and simplicity.
We’ll wrap up with a glimpse into future webinars, followed by a Q&A session to address your specific questions surrounding this topic.
Don’t miss this opportunity to elevate your FME expertise and drive your projects to new heights of efficiency.
Connector Corner: Automate dynamic content and events by pushing a buttonDianaGray10
Here is something new! In our next Connector Corner webinar, we will demonstrate how you can use a single workflow to:
Create a campaign using Mailchimp with merge tags/fields
Send an interactive Slack channel message (using buttons)
Have the message received by managers and peers along with a test email for review
But there’s more:
In a second workflow supporting the same use case, you’ll see:
Your campaign sent to target colleagues for approval
If the “Approve” button is clicked, a Jira/Zendesk ticket is created for the marketing design team
But—if the “Reject” button is pushed, colleagues will be alerted via Slack message
Join us to learn more about this new, human-in-the-loop capability, brought to you by Integration Service connectors.
And...
Speakers:
Akshay Agnihotri, Product Manager
Charlie Greenberg, Host
UiPath Test Automation using UiPath Test Suite series, part 3DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 3. In this session, we will cover desktop automation along with UI automation.
Topics covered:
UI automation Introduction,
UI automation Sample
Desktop automation flow
Pradeep Chinnala, Senior Consultant Automation Developer @WonderBotz and UiPath MVP
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Ramesh Iyer
In today's fast-changing business world, Companies that adapt and embrace new ideas often need help to keep up with the competition. However, fostering a culture of innovation takes much work. It takes vision, leadership and willingness to take risks in the right proportion. Sachin Dev Duggal, co-founder of Builder.ai, has perfected the art of this balance, creating a company culture where creativity and growth are nurtured at each stage.
JMeter webinar - integration with InfluxDB and GrafanaRTTS
Watch this recorded webinar about real-time monitoring of application performance. See how to integrate Apache JMeter, the open-source leader in performance testing, with InfluxDB, the open-source time-series database, and Grafana, the open-source analytics and visualization application.
In this webinar, we will review the benefits of leveraging InfluxDB and Grafana when executing load tests and demonstrate how these tools are used to visualize performance metrics.
Length: 30 minutes
Session Overview
-------------------------------------------
During this webinar, we will cover the following topics while demonstrating the integrations of JMeter, InfluxDB and Grafana:
- What out-of-the-box solutions are available for real-time monitoring JMeter tests?
- What are the benefits of integrating InfluxDB and Grafana into the load testing stack?
- Which features are provided by Grafana?
- Demonstration of InfluxDB and Grafana using a practice web application
To view the webinar recording, go to:
https://www.rttsweb.com/jmeter-integration-webinar
Transcript: Selling digital books in 2024: Insights from industry leaders - T...BookNet Canada
The publishing industry has been selling digital audiobooks and ebooks for over a decade and has found its groove. What’s changed? What has stayed the same? Where do we go from here? Join a group of leading sales peers from across the industry for a conversation about the lessons learned since the popularization of digital books, best practices, digital book supply chain management, and more.
Link to video recording: https://bnctechforum.ca/sessions/selling-digital-books-in-2024-insights-from-industry-leaders/
Presented by BookNet Canada on May 28, 2024, with support from the Department of Canadian Heritage.
UiPath Test Automation using UiPath Test Suite series, part 4DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 4. In this session, we will cover Test Manager overview along with SAP heatmap.
The UiPath Test Manager overview with SAP heatmap webinar offers a concise yet comprehensive exploration of the role of a Test Manager within SAP environments, coupled with the utilization of heatmaps for effective testing strategies.
Participants will gain insights into the responsibilities, challenges, and best practices associated with test management in SAP projects. Additionally, the webinar delves into the significance of heatmaps as a visual aid for identifying testing priorities, areas of risk, and resource allocation within SAP landscapes. Through this session, attendees can expect to enhance their understanding of test management principles while learning practical approaches to optimize testing processes in SAP environments using heatmap visualization techniques
What will you get from this session?
1. Insights into SAP testing best practices
2. Heatmap utilization for testing
3. Optimization of testing processes
4. Demo
Topics covered:
Execution from the test manager
Orchestrator execution result
Defect reporting
SAP heatmap example with demo
Speaker:
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
GraphRAG is All You need? LLM & Knowledge GraphGuy Korland
Guy Korland, CEO and Co-founder of FalkorDB, will review two articles on the integration of language models with knowledge graphs.
1. Unifying Large Language Models and Knowledge Graphs: A Roadmap.
https://arxiv.org/abs/2306.08302
2. Microsoft Research's GraphRAG paper and a review paper on various uses of knowledge graphs:
https://www.microsoft.com/en-us/research/blog/graphrag-unlocking-llm-discovery-on-narrative-private-data/
2. Basic Ruby
Methods
Classes
Method-Access Rules
What’s in an Object?
Classes in Depth
What Happens When You Call a Method?
Module
Constants
Self
Scope
Singleton Method
3.
4. Local variables
start with a lowercase letter or an underscore
Eg: x, string, __abc__, start_value, and firstName
Ruby convention is to use underscores with multiple
words (first_name)
can't start with an uppercase letter
Instance variables
storing information for individual objects
always start with a single at-sign(@)
can start with an uppercase letter
5. Class variables
store information per class hierarchy
follow the same rules as instance variables
start with two at-signs: @@running_total
Global variables
recognizable by their leading dollar sign ($)
$:, $1, and $/, $stdin and $LOAD_PATH
6. predefined, reserved terms associated with
specific programming tasks and contexts.
def,
class,
if, and
__FILE__
7. Ruby interprets it as one of three things:
A local variable
A keyword
A method call
Here’s how Ruby decides:
1. If the identifier is a keyword, it’s a keyword.
2. If there’s an equal sign (=) to the right of the
identifier, it’s a local variable.
3. Otherwise, assumed to be a method call.
8.
9. When you load a file, Ruby looks for it in each of its
load path.
The last directory is the current directory.
load is a method.
Load file from relative directories
load "../extras.rb"
load "/home/users/dblack/book/code/loadee.rb"
A call to load always loads the file you ask for.
Good to examine the effect of changes immediately.
12. Follow the same rules and conventions as
local variables
except, can end with ?, !, or =
Methods are expressions that provide a value.
In some contexts, you can’t tell, just by
looking at an expression.
13. Ruby sees all data structures and values as
objects.
x = "100".to_i(9)
Methods can take arguments.
Parentheses are usually optional.
Many programmers use parentheses in most or all
method calls, just to be safe.
14. Have to supply the correct number of
arguments.
15. A method that allows any number of
arguments.
def multi_args(*x)
puts "I can take zero or more arguments!"
end
multi_args(1,2,4)
multi_args(1,2)
17. Ruby tries to assign values to as many variables
as possible.
The sponge parameters get the lowest priority.
18.
19. Required ones get priority, whether they
occur at the left or at the right of the list.
All the optional ones have to occur in the
middle.
def broken_args(x,*y,z=1)
syntax error
end
20.
21.
22. Classes define clusters of behavior or
functionality.
Classes can respond to messages, just like
objects.
Objects can change, acquiring methods and
behaviors that were not defined in their class.
23. In Ruby, classes are objects.
The new method is a constructor.
Classes are named with constants.
24. Ruby executed the code within the class just
as it would execute any other code.
25. It’s possible to reopen a class and make
additions or changes.
26. These methods defined inside a class.
Used by all instances of the class.
They don’t belong only to one object.
27. Enables individual objects to remember state.
Always start with @.
Visible only to the object to which they
belong.
Initialized in one method definition is the
same as in other method definitions.
30. Ruby allows you to define methods that end
with an equal sign (=).
def price=(amount) ticket.price=(63.00)
@price = amount ticket.price = 63.00
end
31. The attributes are implemented as reader
and/or writer methods.
32.
33. Ruby supports only single inheritance.
Classes can import modules as mixins.
The class Object is almost at the top of the
inheritance chart.
34.
35. • Private methods can’t be called with an explicit receiver.
class Baker class Baker
def bake_cake def bake_cake
pour_flour pour_flour
add_egg add_egg
end end
def pour_flour private
end def pour_flour
def add_egg end
end def add_egg
private: pour_flour, end
:add_egg end
end
36. It’s OK to use an explicit receiver for private
setter methods.
37.
38. The top-level method is stored as a private
instance method of the Object class.
39.
40. Every object is “born” with certain innate
abilities.
object_id
respond_to?
send
methods
instance_variables
41.
42. Not uncommon to define a method called
send.
Then, use __send__ instead.
public_send, a safe version of send method.
send can call an object’s private methods
public_send can’t.
43.
44. Every class is an instance of a class called
Class.
You can also create a class the same way you
create most other objects.
my_class = Class.new
instance_of_my_class = my_class.new
45.
46.
47. The class Class is an instance of itself.
Object is a class, Object is an object.
And Class is a class. And Object is a class, and
Class is an object.
Which came first?
Ruby has to do some of this chicken-or-egg stuff
in order to get the class and object system up and
running.
48. Classes are objects.
Instances of classes are objects, too.
A class object has its own methods, its own
state, its own identity.
49.
50. When you call a method, Ruby does two
things:
It finds the method (method lookup).
It executes the method. (find self).
52. How objects call their methods?
From their class
From the superclass and earlier ancestors of their
class
From their own store of singleton methods
Instances of Class can call methods that are
defined as instance methods in their class.
Class defines an instance method called new.
Ticket.new
53. The class Class has two new methods as:
a class method; Class.new
an instance method; Ticket.new
Instances of Class have access to the instance
methods defined in Module.
class Ticket
attr_reader :venue, :date
attr_accessor :price
54.
55. Modules are bundles of methods and
constants.
Modules don’t have instances.
Consists of the functionality to be added to a
class or an object.
Modules encourage modular design.
Modules are the more basic structure, and
classes are just a specialization.
56. Modules get mixed in to classes, using the
include method, referred to as mix-ins.
The instances of the class have the ability to
call the instance methods defined in the
module.
A class can mix in more than one module.
57.
58. To resolve a message into a method:
Its class
Modules mixed into its class
The class’s superclass
Modules mixed into the superclass
Likewise, up to Object (and its mix-in Kernel) and
BasicObject
59. Define a method twice inside the same class,
the second definition takes precedence.
class D
def hello
puts “hello”
end
end
class D
def hello
puts “hello world”
end
end
60. If the object’s method-lookup path includes
more than two same methods, the first one is
the “winner”.
61. A class mixes in two or more modules.
The modules are searched in reverse order of
inclusion
62. class C
include M
include N
include M
end
Re-including a module doesn’t do anything.
N is still considered the most recently
included module.
63. Use the super keyword to jump up to the
next-highest definition, in the method-
lookup path.
64. The way super handles arguments:
Called with no argument list – super
Called with an empty argument list – super()
Called with specific arguments – super(a,b,c)
65. The Kernel module provides an instance method called
method_missing.
66. Nested module/class chains are used to
create namespaces for classes, modules, and
methods.
module Tools
class Hammer
end
End
h = Tools::Hammer.new
67.
68. Begin with an uppercase letter.
eg: A, String, FirstName, and STDIN
(FirstName) or (FIRST_NAME) is usual.
Can be referred to from inside the instance or
class methods.
69. You get a warning if you reassign to the
constant.
To modify a constant, use a variable instead.
not redefining a constant,
good for reloading program files
70. Constants have a kind
of global visibility or
reachability.
Bears a close
resemblance to
searching a filesystem.
71. Like /, the :: means “start from the top level.”
72.
73. At every moment, only one object is playing
the role of self.
Self is the default object or current object.
To know which object is self, you need to
know what context you’re in.
74.
75.
76. But what is self when you haven’t yet entered
any definition block?
The answer is that Ruby provides you with a start-
up self at the top level.
ruby -e 'puts self'
main is a special term that the default self
object.
The keyword (class, module, or def) marks a
switch to a new self.
77. In a class or module definition, self is the class
or module object.
78. In a method definition, self is the object that
called it.
79. When a singleton method is executed, self is
the object that owns the method.
80. If the receiver of the message is self, you can
omit the receiver and the dot.
81. If both a method and a variable of a given
name exist (talk), the variable takes
precedence.
To force Ruby to see as a method name, you’d
have to use self.talk or talk().
To call a setter method, have to supply
object-dot-notation.
self.first_name = “dara”
first_name = “dara”
85. Scope refers to the reach or visibility of
variables and constants.
Three types of variables: global, local, and
class variables.
86. Global scope is scope that covers the entire
program.
Global scope is enjoyed by global variables.
87. Local scope is a basic layer of every Ruby
program.
Every time you cross into a class, module, or
def keyword, you start a new local scope.
The top level has its own local scope.
Every class or module definition block has its own
local scope.
Every method definition has its own local scope.
88.
89.
90. Provides a storage mechanism shared
between a class and its instances.
Visible only to a class and its instances.
95. Let’s say we’ve created our Ticket class.
Ticket isn’t only a class.
Ticket is also an object in its own right.
defined directly on the class object Ticket.
referred to as a class method of the class.
96. Where do singleton methods live?
The singleton class
Every object has two classes:
The class of which it’s an instance
Its singleton class
97. Singleton classes are anonymous.
The << object notation means the anonymous,
singleton class of object.
98.
99.
100. The Well-Grounded Rubyist, David A. Black
Metaprogramming Ruby, Paolo Perrotta