技术标签: 红宝石
I'm at the point in learning Ruby where I'd like to look at some small-ish libraries' source code to see how they were built. I do not know what is considered a small library but was hoping SO could recommend some easy-to-understand libraries to study.
So if anyone knows a very tiny library or two that's a good example for novice Rubyists to study, please recommend!
I wanted to use Manveru's Innate lib because it tries to stay under 2000 LOC but I'm not yet familiar with the Ruby shorthand that is used so much within it.
Maybe some ~100 - ~500 LOC libs would be better for me?谢谢你。
Ryan "ZenSpider" Davis's stuff is always interesting. It is however, not entirely suited for beginners. On the one hand, Ryan is absolutely fanatical about keeping things, simple, short and clean, which helps understandability quite a bit. On the other hand, he 做 use pretty much all of Ruby's power to achieve that.
One of the most amazing examples of his work, is MiniTest, the new testing framework which replaces Test::Unit in the Ruby 1.9 standard library. It contains a full xUnit style testing framework in 419 lines, 一个 RSpec style BDD framework in 87 lines A. full mocking framework in a whopping 28 lines.
But, for example, the way that the BDD framework is so small, is that it uses reflective metaprogramming to dynamically loop over the assertion methods from the testing framework and rename them to BDD style must_ 方法。
Another nice example is also a BDD framework by Christian Neukirchen: Bacon has 291 lines。还要退出 his other stuff, 例如 他的 mocking framework in 131 lines, forum software in 488 lines 和 blog engine in 146 lines.
Last but not least, there is Gregory Brown's Prawn PDF Generation library。 The interesting thing about Prawn is actually that it was deliberately written 不仅仅 as a PDF Generation library but 还 as an example of well-written, well-designed Ruby code.再次, his other stuff is also interesting, like 他的 blogging engine in 184 lines.
Speaking of Greg Brown and well-written code: Greg is the author of the book Ruby最佳实践, which uses real-life code examples from real-life Ruby projects to show what good, well-written, well-designed Ruby code looks like. (Plus, it also has a chapter called Ruby Worst Practices with anti-examples.) And, you don't even have to buy the book (although you 真的 should), because all the code samples are on GitHub!
The Beginner’s Guide To Grammar2018翻译。每天翻译一点儿,学习加锻炼英文水平。 语法初学者指南-01序言 Hello there! If you ever feel dread when you hear the word grammar, I understand. I used to feel the same way. For years, I ...
A Beginner's Guide To Understanding Convolutional Neural Networks Introduction Convolutional neural networks. Sounds like a weird combination of biology and math with a little CS sprinkled in, but the...
Share this: In this article, I will go through some common questions people tend to raise when they are using MOSFET, and the basics of MOSFET. This tutorial is primarily written for non-academic peop...
原文网址:http://blog.csdn.net/darkprince120/article/details/52807029 Introduction 卷积神经网络CNN,虽然它听起来就像是生物学、数学和计算机的奇怪混杂产物,但在近些年的机器视觉领域,它是最具影响力的创新结果。随着Alex Krizhevsky开始使用神经网络,将分类错误...
函数都有prototype属性,它指向原型对象。 实例对象有__proto__属性,它指向对象原型 每一个原型对象都有constructor输赢,指向构造函数,每一个原型对象又具有__proto__属性,这个指向Object.prototype.在这里插入图片描述...
2.Dubbo简介 2.1 什么是dubbo Dubbo是一款高性能、轻量级的开源Java RPC框架,它提供了三大核心能力:面向接口的远程方法调用,智能容错和负载均衡,以及服务自动注册和发现。 2.2 流程图 Provider : 暴露服务的服务提供方。 Consumer : 调用远程服务的服务消费方。 Registry : 服务注册与发现的注册中心。 Monito...
mysql基础入门的总结 关于数据库: 数据库是软件开发人员要掌握的基本工具,软件的运行的过程就是操作数据的过程,数据库中的数据无非就是几个操作:增-删-查-改。 Mysql安装完成后,需要配置变量环境,找到配置路径path,然后把mysql安装目录bin文件导入就可以了。 然后运行cm...
adb常用命令: 查看手机是否连接:adb devices 连接设备:adb connect 设备ip:端口号 若有连接多个设备需指明设备ip及端口号 安装APP:adb install [-r] 包名 -r表示覆盖安装,首次安装可省略 卸载APP:adb uninstall 包名 列出设备中所有应用包名:adb shell pm list packages ...
以谷歌浏览器为例,注意有些浏览器并不支持该功能。 1)打开自定义与控制 2)选择设置 3)查看左边状态栏,选择高级设置--》隐私设置和安全性 4)选择内容设置 5)图片 6)选择不显示任何图片,其中也可以只禁用某些网站图片,或者只开启自己想显示图片的网站...
IDEA中使用springMVC 出现 404请求的资源不可用的其他一个可能原因 如果你确认你在视图解析器中的路径设置没有问题,各种文件名都没问题,却依然出现资源不可用错误 你可以检查这个页面中是否为web部署了工件,没有的话部署一下就好了。...
I'm currently trying out the google cloud messaging service with its sample application "Guestbook." https://developers.google.com/cloud/samples/mbs/ I'm attempting to send notifications tha...
Now I came across an article that distinguishes between an Asynchronous function and Synchronous functions. From my understanding of the different examples and explanations, synchronous functions are ...
Good day all I'm busy creating a small costing calculator for the signage department. I'm not getting the calculator to output the amount. Brief Description: You enter the height and width and then wh...
I have 3 models created with Flask-SQLalchemy: User, Role, UserRole role.py: user.py: user_role.py: If I try (in the console) to get all users via User.query.all() I get AttributeError: 'NoneType' obj...
I have many particles that follow an stochastic process in parallel. For each particle, there is a PRNG associated to it. The simulation must go through many repetitions to get average results. For ea...