Ruby_Scripting
Ruby_Scripting copied to clipboard
examples based tutorial for Ruby scripting
Ruby Scripting
- Introduction to Ruby, syntax, issuing external commands, array/string methods, regular expressions, file processing and more...
- Suitable for those already familiar with programming concepts like variables, printing, control structures, looping, arrays, etc
- If you are new to programming, check out Think Ruby, a translation of Think Python by Allen Downey that I'm working on
- This repo is also suitable as a material reference for a one/two day workshop
- For more related resources, visit scripting course and my programming blog https://learnbyexample.github.io
Chapters
:warning: :construction: Work in progress, stay tuned...
- Introduction
- Installation, Hello World example, Ruby REPL
- Numbers and Strings
- Numbers, String, Objects and Expressions
- Getting User input
- String input, Converting string to other data types
- Methods
- Defining a method, Arguments and Return, Default valued arguments, Keyword arguments, Special method names, Variable Scope
- Control Structures
- Boolean expressions, if, for, while, next and break, Variable Scope
- Executing external commands
- Issuing commands, Saving command output
- Arrays
- Assignment and Indexing, Slicing, Copying, Looping, Modifying elements, Filtering, Sorting and company, Transforming whole array, Miscellaneous, Getting Array as user input
- Hashes
- Initialization, Accessing keys and values, Looping, Modifying elements, Filtering, Transforming keys and values, Mutable keys, Miscellaneous
- Set
- Initialization, Set operations, Miscellaneous
- String Methods
- String formatting, Looping, Condition checks, Case conversion, Search and Replace, Splitting, Character manipulations, Miscellaneous
- Regular Expressions
- Why is it needed?, Syntax and operators, Anchors, Alternation and Grouping, Escaping metacharacters, Dot metacharacter and Quantifiers, match, scan and globals, Character class, Groupings and backreferences, Lookarounds, Modifiers, Unicode, Miscellaneous, Gotchas, Further Reading
- File Processing
- Modes and Encoding, Reading files, Writing files, Interacting with File System
- Exercises
Contributing
- Please open an issue for typos/bugs/suggestions/etc
- Please open an issue for discussion before submitting PRs
- Share the repo with friends/colleagues, on social media, etc to help reach other learners
- In case you need to reach me, mail me at
echo '[email protected]' | tr 'a-z' 'n-za-m'or send a DM via twitter
ebook
- Read as ebook on gitbook
- All
legacy.gitbook.comlinks are now automatically redirected togitbook.com, so there's no longer an option to download ebooks for offline reading
Acknowledgements
- ruby-lang documentation - manuals, tutorials and references
- /r/ruby/ - helpful forum for beginners and experienced programmers alike
- stackoverflow - for getting answers to pertinent questions
- Ruby Tricks, Idiomatic Ruby, Refactorings and Best Practices
License
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License