Sha256: dcc55176b2de498d38e2ee9a6bb53a05c9065ee60a3cff4800be5b20266dd269

Contents?: true

Size: 303 Bytes

Versions: 1

Compression:

Stored size: 303 Bytes

Contents

class User
  follows_the_rules!
  
  attr :role
  
  def initialize
    @role = :user
  end
  
  def_class_rule(/new_(admin|moderator|user)/) do |role|
    new.instance_eval { @role = role.to_sym; self }
  end
  
  def_rule(/is_(admin|moderator|user)\?/) do |role|
    @role == role.to_sym
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rulebook-0.5.0 spec/support/user.rb