- TL; DR
- Why?
- When?
- How?
4.1. Enumerator (skip if familiar with)
4.2. Lazy enumerator
4.3. C patch - Conclusion
TL; DR
| language: ruby | |
| before_install: | |
| - "export DISPLAY=:99.0" | |
| - "sh -e /etc/init.d/xvfb start" | |
| before_script: | |
| - cp config/database.travis.yml config/database.yml | |
| - RAILS_ENV=test bundle exec rake db:create db:migrate | |
| notifications: | |
| email: | |
| - [email protected] |
| require 'rails/application/route_inspector' | |
| all_routes = Rails.application.routes.routes.select { |r| r.defaults[:controller] =~ /api\/v1/ } | |
| inspector = Rails::Application::RouteInspector.new | |
| pp inspector.format(all_routes, 'api/v1/inboxes').map { |x| x.split(' ') } | |
| # [["api_v1_inbox", | |
| # "POST", | |
| # "/api/v1/inboxes/:id(.:format)", | |
| # "api/v1/inboxes#update"], | |
| # ["api_v1_inboxes", |
| def to_lambda &block | |
| obj = Object.new | |
| obj.define_singleton_method(:_, &block) | |
| return obj.method(:_).to_proc | |
| end | |
| def with_file(name, &block) | |
| l = to_lambda(&block) | |
| puts "Open file" | |
| f = File.open(name, "r") |
| require 'net/smtp' | |
| (0..9).each do |i| | |
| message = <<-END.split("\n").map!(&:strip).join("\n") | |
| From: Private Person <[email protected]> | |
| To: A Test User <[email protected]> | |
| Subject: #{i} message | |
| This is a test e-mail message. | |
| END |
TL; DR