Module: Contextually

Defined in:
lib/contextually.rb,
lib/contextually/definition.rb,
lib/contextually/example_extension.rb

Defined Under Namespace

Modules: ExampleExtension Classes: Definition, Role, UndefinedContext

Constant Summary collapse

VERSION =
'0.1'

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.before_allObject

Returns the value of attribute before_all.



36
37
38
# File 'lib/contextually/definition.rb', line 36

def before_all
  @before_all
end

.deny_access_to_allObject

Returns the value of attribute deny_access_to_all.



36
37
38
# File 'lib/contextually/definition.rb', line 36

def deny_access_to_all
  @deny_access_to_all
end

.rolesObject

Returns the value of attribute roles.



36
37
38
# File 'lib/contextually/definition.rb', line 36

def roles
  @roles
end

Class Method Details

.before(role) ⇒ Object



49
50
51
# File 'lib/contextually/definition.rb', line 49

def before(role)
  role(role).before
end

.define(&block) ⇒ Object



57
58
59
# File 'lib/contextually/definition.rb', line 57

def define(&block)
  Contextually::Definition.define(&block)
end

.deny_access(role) ⇒ Object



53
54
55
# File 'lib/contextually/definition.rb', line 53

def deny_access(role)
  role(role).deny_access || deny_access_to_all
end

.groupsObject



38
39
40
# File 'lib/contextually/definition.rb', line 38

def groups
  @groups ||= {}
end

.role(role) ⇒ Object



42
43
44
45
46
47
# File 'lib/contextually/definition.rb', line 42

def role(role)
  unless roles and roles.has_key?(role)
    raise Contextually::UndefinedContext, "no role called #{role.inspect} exists"
  end
  roles[role]
end