Class: Bali::RoleExtractor

Inherits:
Object
  • Object
show all
Defined in:
lib/bali/foundations/role_extractor.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(arg) ⇒ RoleExtractor

argument can be anything, as long as role extractor know how to extract



5
6
7
# File 'lib/bali/foundations/role_extractor.rb', line 5

def initialize(arg)
  @arg = arg
end

Instance Attribute Details

#argObject (readonly)

Returns the value of attribute arg.



2
3
4
# File 'lib/bali/foundations/role_extractor.rb', line 2

def arg
  @arg
end

Instance Method Details

#get_roles(object = @arg) ⇒ Object



9
10
11
12
13
14
15
16
17
18
# File 'lib/bali/foundations/role_extractor.rb', line 9

def get_roles(object = @arg)
  case object
  when String; get_role_string(object)
  when Symbol; get_role_symbol(object)
  when NilClass; get_role_nil(object)
  when Array; get_role_array(object)
  else
    get_role_object(object)
  end
end