Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Domain Specific Languages and Ruby

Domain Specific Languages and Ruby

Domain Specific Languages
What are they and how does Ruby help

Tawan Sierek

February 04, 2016
Tweet

Other Decks in Programming

Transcript

  1. SQL

  2. SQL

  3. class Person < ActiveRecord::Base
 validates :name, presence: true 
 validates

    :email, confirmation: true
 validates :age, numericality: true, on: :update
 end Rails’ ActiveModel
  4. authorization do
 privileges do
 privilege :manage, :includes => [:create, :read,

    :update ]
 privilege :create, :includes => :new
 privilege :read, :includes => [:index, :show]
 privilege :update, :includes => :edit
 privilege :delete, :includes => :destroy
 end
 
 role :branch_admin do
 has_permission_on :branches, :to => :manage do
 if_attribute :managers => contains {user}
 end
 
 has_permission_on :employees, :to => :manage do
 if_permitted_to :manage, :branch
 end
 end
 end Declarative Authorization https://github.com/stffn/declarative_authorization