Class: Detour::DefinedGroup

Inherits:
Object
  • Object
show all
Defined in:
app/models/detour/defined_group.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, test) ⇒ DefinedGroup

Returns a new instance of DefinedGroup.



5
6
7
8
# File 'app/models/detour/defined_group.rb', line 5

def initialize(name, test)
  @name = name.to_s
  @test = test
end

Instance Attribute Details

#nameObject (readonly) Also known as: id

Returns the value of attribute name.



2
3
4
# File 'app/models/detour/defined_group.rb', line 2

def name
  @name
end

Class Method Details

.by_type(type) ⇒ Object



18
19
20
# File 'app/models/detour/defined_group.rb', line 18

def self.by_type(type)
  Detour.config.defined_groups.fetch(type.to_s, {}).with_indifferent_access
end

Instance Method Details

#test(arg) ⇒ Object



14
15
16
# File 'app/models/detour/defined_group.rb', line 14

def test(arg)
  @test.call(arg)
end

#to_sObject



10
11
12
# File 'app/models/detour/defined_group.rb', line 10

def to_s
  name
end