2. What is it?
● Annually in Australia (Melbourne/Sydney)
● Around the world (e.g. Miami, India, Argentina)
● Variety of talks held over 2 days
● Local and International speakers
● A day of workshops (e.g. Rails Girls Next, C Extensions,
Rspec)
● Best practises, examples, inspiration, meet new people
● Videos - http://vimeo.com/rubyau
3. This Year
● Continuous Delivery
● Rails Engines
● Middleware
● Ruby 2.1
● Minitest
● Programming as a Parent
● Asset Pipeline
● MongoDB
● Concurrency Practices in Ruby
● JRuby
● Security
● Loads more ... https://m.lanyrd.com/2014/rubyconf-au/schedule/
● Videos - http://vimeo.com/rubyau
4. The Snippets
● Continuous Deployment
● Rails Engines
● C Extensions
● Community
10. Rails Engines
● Avoid accessing ActiveRecord
directly
● Domain API
● Smart & Fast test suite => test
changes in the changed engine
11. C Extensions
● C code in a Ruby Gem
● E.g. nokogiri
● Testable (write Rspec on C code!)
● Why? speedier (Ruby is not slow, but not great on
processing e.g. image processing)
● Ruby wrapper for C libs
12. C Extensions
bundle gem <gem_name> create the gem
# <gem_name>.gemspec
spec.add_development_dependency "rake-compiler"
# Rakefile
require "rake/extensiontask"
Rake::ExtensionTask.new('rbshop') do |ext|
ext.lib_dir = "lib/rbshop"
end
mkdir -p ext/gem_name C code lives here
13. C Extensions
# ext/gem_name/extconf.rb add extension config file
require ‘mkmf’ creates makefile to compile C code
create_makefile(‘gem_name’)
# ext/gem_name/gem_name.c
initialise the extension
ruby.h is the C API
e.g. INT2NUM
14. C Extensions
● free() and malloc()
● Tell Ruby what
methods to allocate
and free memory
● Ruby holds onto
memory until it
needs to free it
15. C Extensions
➔ Call functions that define modules/classes:
◆ rb_define_module - Creates modules
◆ rb_define_class_under - Creates a new class
◆ rb_define_alloc_func - Lets you control how allocation happens
➔ Types
◆ Strings, Arrays, Hashes, Numbers
◆ Check_Type(r_radius, T_FLOAT)
◆ E.g. Strings
● rb_str_new(const char *ptr, long len)
● rb_str_new2(const char *ptr)
● rb_str_cat(VALUE str, const char *ptr, long len)
● rb_str_modify(VALUE str)
17. Community
● Rails Girls and Rails Girls Next
● RoRo Syd
● Ninefold, Re-Interactive
● Installfest, Developer Hub
● General Assembly
● New Groups - Ruby Women, Women Who
Code