gem install cassandra
gem install simple_uuid
Updated workflow from Up and running with Cassandra.
irb
# in lib/apotomo/widget.rb | |
# This comes redundant with Cells internals, but this is due to what may be a flaw in current Apotomo's design, | |
# which bypass Cells workflow (render_cell_for) and hook directly into AbstractController::Rendering #render_state | |
# Renders the +widget+ (instance or id). | |
def render_widget(widget_id, state=:display, *args) | |
if widget_id.kind_of?(Widget) | |
widget = widget_id | |
else | |
widget = find_widget(widget_id) or raise "Couldn't render non-existent widget `#{widget_id}`" |
class MyController < ApplicationController | |
include Apotomo::Rails::ControllerMethods | |
has_widgets do |root| | |
if must_attach_a_wigdet? | |
# current_widget_data is anything that the Cell needs to build | |
# the widget (say, a User record…) | |
root << widget('my_widget', | |
"widget_#{@current_widget_data.id}", |
module Bar | |
def do_sth | |
puts "@proxy: #{@proxy.inspect}" | |
end | |
end | |
class Foo | |
include Bar | |
def initialize |
gem install cassandra
gem install simple_uuid
Updated workflow from Up and running with Cassandra.
irb
require 'facets/kernel/constant' | |
require 'active_support/core_ext/module/attribute_accessors' | |
module Metamorphosis | |
module Injector | |
@@receiver = "Foo" | |
def clutch cst_path, *directives, &blk | |
raise ArgumentError unless cst = Object.constant([@@receiver, cst_path].join("::")) | |
raise ArgumentError unless cst.is_a? Class or cst.is_a? Module |
module Base | |
module Plugins | |
def self.plugins | |
@plugins ||= [] | |
end | |
def self.activate plugin_name | |
begin | |
plugin = Base::Plugins.const_get(plugin_name.capitalize) | |
rescue |
# ./base.rb | |
require 'base/plugins' | |
module Base | |
class Server | |
include Plugins | |
def say(what) | |
p "say: #{what}" |
module Base | |
class Server | |
def blabla(argument) | |
@config ||= "default" | |
if @config == "default" | |
p "Server says: #{argument}" | |
end | |
puts "config: #{@config}" |
# no explicit reference to web_steps | |
# that is, features/authentication/step_definitions/authentication_steps.rb contains: | |
Given /^I am not authenticated$/ do | |
# do nothing | |
end | |
$ cucumber features/authentication/authentication.feature | |
Using the default profile... | |
Feature: User authentication | |
To ensure the safety of the application |