Category Archives: Ruby

End Of Iteration 2013w48

Previous Post 
Next Post

Talk about Implementing Ruby

I gave a talk at RubyConf Argentina 2013, about implementing Ruby. Slides source at:

https://github.com/ajlopez/Talks/tree/master/ImplementingRuby

To be viewed online at:

http://ajlopez.github.io/Talks/ImplementingRuby/index.html

It mentioned my work on RubySharp

https://github.com/ajlopez/RubySharp

my Ruby interpreter written in C#. Now, it can access native types and objects, requiring .rb modules or native .dlls.

My Apps

I updated the repo of my dynamic apps application (Node.js)

https://github.com/ajlopez/MyApps

I should add MongoDB as first persistence implementation.

SimpleGrammar

I published 0.0.3 version:

https://github.com/ajlopez/SimpleGrammar/commits/master

The new feature: a “peek” function, to look at the next token, without removing it.

I added the new feature to https://github.com/ajlopez/RuScript grammar (my Ruby interpreter in JavaScript).

Other works:

– Update SimpleYaml https://github.com/ajlopez/SimpleYaml to support real numbers

– Test refactor of CobolScript https://github.com/ajlopez/CobolScript/commits/master

– Update ClojScript to Visual Studio 2010 https://github.com/ajlopez/ClojSharp/commits/master

And I was working on two non-public projects.

This new week will be dedicated to some JavaScript projects and ideas, and to give a one-day course of Node.js

Keep tuned!

Angel “Java” Lopez
http://www.ajlopez.com
http://twitter.com/ajlopez

TDD Rocks! (6) Playing with Ruby

Previous Post
Previous Post with Ruby

I’m still learning Ruby. To practice the language, I’m writing a Tokenizer using my TDD (Test-Driven Development) workflow.

A new video at

http://www.youtube.com/watch?v=X-mTCyhm7ds

I did two redesigns:

– To provide the text to tokenize in the tokenizer constructor

– Rename getTokens methods to a more "rubyist” name get_tokens

After those redesigns, I dived into a big implementation refactor. Maybe, I had to avoid that work, or split it in more manageable pieces. At the end, I survived, and the tokenizer implementation is started to emerge. You can check another of my implementations, in JavaScript/NodeJs:

https://github.com/ajlopez/KodeTokenizer

The Ruby version is at:

https://github.com/ajlopez/TddRocks/commits/master/Ruby

Keep tuned!

Angel “Java” Lopez
http://www.ajlopez.com
http://twitter.com/ajlopez

End Of Iteration 2013w47

Previous Post
Next Post

Implementing Ruby

My main outcome is my work on implementing Ruby, using C#:

https://github.com/ajlopez/RubySharp

I implemented:

– Access to native types and objects
– Modules
– Classes
– Nested modules and classes
– Require of Ruby programs
– Require of native dlls
– Singleton class
– Examples (console, win forms, http)

I will present this work this week, at RubyConf Argentina 2013

http://rubyconfargentina.org/en/

Implementing Ruby in JavaScript

I started a new implementation, this time in JavaScript

https://github.com/ajlopez/RuScript

It is still work in progress. I’m using SimpleGrammar for the parser/lexer, but I should review this path. Ruby syntax has some quirks to tackle.

Other works:

– Refactor of CobolScript: https://github.com/ajlopez/CobolScript
– Work on three non-public projects

Keep tuned!

Angel “Java” Lopez
http://www.ajlopez.com
http://twitter.com/ajlopez

Ruby: Links, News And Resources (6)

Previous Post
Next Post

defunkt / resque
https://github.com/defunkt/resque
Resque is a Redis-backed Ruby library for creating background jobs, placing them on multiple queues, and processing them later.

bvandenbos / resque-scheduler
https://github.com/bvandenbos/resque-scheduler
A light-weight job scheduling system built on top of resque

Understanding Rack
http://tekpub.com/view/rack/1

The Ruby Toolbox
https://www.ruby-toolbox.com/

Fiasco
http://tizoc.github.com/fiasco/
Fiasco is a thin and modular layer on top of Rack inspired by Flask, Jinja2 and Cuba.

List of Ruby Web Frameworks
http://vemod.net/list-of-ruby-web-frameworks

cuba
http://rubygems.org/gems/cuba
Cuba is a microframework for web applications.

An introduction to RSpec – Part I
http://blog.davidchelimsky.net/2007/05/14/an-introduction-to-rspec-part-i/

Getting Started with RSpec – Looking for tutorials
http://stackoverflow.com/questions/201385/getting-started-with-rspec-looking-for-tutorials

Programming for the Web with Ruby
http://rubylearning.com/blog/2012/01/21/free-online-course-programming-for-the-web-with-ruby/

Ruby Guide
http://www.caliban.org/ruby/rubyguide.shtml

bbatsov / ruby-style-guide
A community-driven Ruby coding style guide

Programming Ruby, The Pragmatic Programmer’s Guide
http://ruby-doc.org/docs/ProgrammingRuby/html/index.html

Writing an API Wrapper in Ruby with TDD
http://net.tutsplus.com/tutorials/ruby/writing-an-api-wrapper-in-ruby-with-tdd/

Ruby is the New Smalltalk
http://silversmalltalk.wordpress.com/2012/01/28/ruby-is-the-new-smalltalk/

Why I love Ruby (Part 1)
http://duckpunching.github.com/2011/02/26/why-i-love-ruby-part-1.html

Lisp in 32 lines of Ruby
http://blog.fogus.me/2012/01/25/lisp-in-40-lines-of-ruby/

.NET to Ruby: Learning How to Write Tests, Part I
http://rubysource.com/net-to-ruby-learning-how-to-write-tests/

NET to Ruby: Learning How to Write Tests, Part II
http://rubysource.com/net-to-ruby-learning-how-to-write-tests-part-ii/

WAT
https://www.destroyallsoftware.com/talks/wat
A lightning talk by Gary Bernhardt from CodeMash 2012

luciolang / lucio
https://github.com/luciolang/lucio
Lucio is a Lisp-like language running on Ruby

Languages, Verbosity, and Java
http://www.informit.com/articles/article.aspx?p=1824790

Infografía: Comparativa entre PHP, Ruby y Python
http://www.genbetadev.com/lenguajes-de-programacion/infografia-comparativa-entre-php-ruby-y-phython

RSpec 2.8: The Popular Ruby BDD Tool Goes Supersonic
http://www.rubyinside.com/rspec-2-8-released-5772.html

Slido: markdown to html5 slideshow
http://joseoncode.com/2011/12/29/slido-markdown-to-html5-slideshow/

Monads in Ruby, Part 1: Introduction
http://moonbase.rydia.net/mental/writings/programming/monads-in-ruby/00introduction.html

My Links
http://delicious.com/ajlopez/ruby

Keep tuned!

Angel “Java” Lopez
http://www.ajlopez.com
http://twitter.com/ajlopez

End Of Iteration 2013w45

Previous Post
Next Post

I’m exhausted, after my Node.js Knockout participation, last week end.

Node Knockout

It is my main deliverable for past week. I wrote a web application, in two days, from scratch, using Node.js and Express. Video with demo:

http://www.youtube.com/watch?v=GQdyyNWCasI

It’s running online at:

http://soloninja.2013.nodeknockout.com/

Now, the repo is private, but I will clone it to my public GitHub account. You can see the votes at:

http://nodeknockout.com/teams/soloninja

TDD and JavaScript

I gave a talk at local JavaScript meetup

Code at:

https://github.com/ajlopez/TddRocks/tree/master/JavaScript

Slides at:

https://github.com/ajlopez/Talks/tree/master/TddJavaScript

Other works

Minor updates at https://github.com/ajlopez/RubySharp

Updated require algorithm at https://github.com/ajlopez/AjTalkJs

Keep tuned!

Angel “Java” Lopez
http://www.ajlopez.com
http://twitter.com/ajlopez

TDD Rocks! (1) Playing with Ruby

Next Post
Next Post with Ruby

Past July, I recorded a Google hangout, about on of my favorite topic: TDD (Test-Driven Development).

My first one:

TDD Rocks (1) Playing with Ruby
http://www.youtube.com/watch?v=L3SuNBDg2IM&feature=youtu.be

Well, I’m using Anglish, that is, Angel’s English ;-).

The idea is to show my TDD workflow, step by step, and in this video I’m using Ruby (I’m learning Ruby). In the second video I added more tests, like recognize numbers, words and symbols. I will apply internal refactoring, and a better implementation. I already applied that workflow in my public projects in Ruby:

AjLispRuby
https://github.com/ajlopez/AjLispRuby
My Lisp interpreter in Ruby, with access to gems

AjGenesisRuby
https://github.com/ajlopez/AjGenesisRuby
Code generation, like AjGenesis in .NET, but now using Ruby

In this video, I’m adding the minimal code to past the test. I don’t separate the class under development from the tests: they are in the same files. You can check project status:

https://github.com/ajlopez/TddRocks/blob/master/Ruby/tokenizer.rb

I will publish posts with more Google hangouts, with TDD using JavaScript, C#, and more Ruby.

Keep Tuned!

Angel “Java” Lopez
http://www.ajlopez.com
@ajlopez

RubySharp, Implementing Ruby In C# (2)

Previous Post
Next Post

I’m working on my Ruby implementation as interpreter written in C#

https://github.com/ajlopez/RubySharp

Today I would like to show that I have implemented many expressions that can be evaluated:

I have implemented commands, too. Initially they were separated:

But now, expressions and commands implement the same interface, to compy with Ruby moto “every is a value”

Evaluate method receives a Context:

I should review if I want or not that Context object has reference to self and other fields. But I wrote all with TDD, so, I could refactor it at any moment.

A code sample, NameExpression .Evaluate method:

public object Evaluate(Context context)
{
    var result = context.GetValue(this.name);

    if (result is IFunction)
        return ((IFunction)result).Apply(null, emptyvalues);

    return result;
}

Notice that I had to take into account the case: the name argument refers to a function. In Ruby, you can call a function simply using the name, the parenthesis are not mandatory.

Next steps: internal refactor, more commands and expressions.

Keep tuned!

Angel “Java” Lopez

http://www.ajlopez.com

http://twitter.com/ajlopez