A proof of concept of having Sinatra like routes inside your controllers.
Since the router is gone, feel free to remove config/routes.rb.
Then add the file below to lib/action_controller/inline_routes.rb
inside your app.
| begin | |
| Sinuous.flow do | |
| task(declares: [ :var1 ]) do | |
| var1, var2 = import :var1, :var2 | |
| var1.value =var2.value | |
| end | |
| task(declares: [ :var2 ]) do | |
| var2, var3 = import :var2, :var3 | |
| var2.value =var3.value | |
| end |
| Failure/Error: expect { | |
| expected Sinuous::DeadlockDetector::DeadlockDetectedError, got #<SystemStackError: SystemStackError> with backtrace: | |
| # ./lib/sinuous/deadlock_detector.rb:57:in `digest' | |
| # ./lib/sinuous/deadlock_detector.rb:65:in `contents' | |
| # ./lib/sinuous/deadlock_detector.rb:90:in `contents' | |
| # ./lib/sinuous/deadlock_detector.rb:65:in `contents' | |
| # ./lib/sinuous/deadlock_detector.rb:90:in `contents' | |
| # ./lib/sinuous/deadlock_detector.rb:65:in `contents' | |
| # ./lib/sinuous/deadlock_detector.rb:90:in `contents' | |
| # ./lib/sinuous/deadlock_detector.rb:65:in `contents' |
| module StaticInstructions::Meta | |
| class BasicFederalTax < Base | |
| include PayPeriods | |
| zero_or_positive! | |
| def value | |
| tr.rate * deps.annual_taxable_income - tr.constant - k1 - k2 - k3 - k4 | |
| end |
| module StaticInstructions::Meta | |
| class BasicFederalTax < Base | |
| include PayPeriods | |
| def calculate(result) | |
| tr = TaxRates.new(result.annual_taxable_income) | |
| zero_or_positive tr.rate * result.annual_taxable_income - tr.constant - k1 - k2(result) - k3 - k4(result) | |
| end | |
| def k4(result) |
| # An experiment in higher-order (?) messages in Ruby. | |
| class Message | |
| attr_reader :name | |
| attr_reader :arguments | |
| def initialize(name, *arguments) | |
| @name = name | |
| @arguments = arguments | |
| end |
| 'use strict'; | |
| angular.module('sherbrookeApp') | |
| .factory 'Collection', [ 'Flash', '$stateParams', 'ResourceConfig', 'Column', | |
| (Flash, params, config, Column) -> | |
| generateColumns = (alias) -> | |
| columns = _.map config[alias].collection.columns, (item) -> new Column(item) |
| class ApiController < ActionController::Metal | |
| include AbstractController::Callbacks | |
| include ActionController::Helpers | |
| include ActionController::Redirecting | |
| include ActionController::MimeResponds | |
| include ActionController::ForceSSL | |
| include ActionController::ParamsWrapper | |
| include ActionController::Instrumentation | |
| include ActionController::Rendering |
| Capybara.add_selector :record do | |
| xpath { |record| XPath.css("#" + ActionController::RecordIdentifier.dom_id(record)) } | |
| match { |record| record.is_a?(ActiveRecord::Base) } | |
| end |
| $VERBOSE = nil | |
| require File.expand_path('../rooby', __FILE__) | |
| Person = Rooby::Class.new 'Person' do | |
| define :initialize do |name| | |
| @name = name | |
| end | |
| define :name do |