Module: SimpleEnumeration
- Defined in:
- lib/simple_enumeration.rb,
lib/simple_enumeration/type.rb,
lib/simple_enumeration/entity.rb,
lib/simple_enumeration/version.rb,
lib/simple_enumeration/collection.rb,
lib/simple_enumeration/type_builder.rb,
lib/simple_enumeration/types/base_factory.rb,
lib/simple_enumeration/types/hash_factory.rb,
lib/simple_enumeration/type_methods_definer.rb,
lib/simple_enumeration/types/string_factory.rb,
lib/simple_enumeration/collections/basic_factory.rb,
lib/simple_enumeration/define_simple_enumeration.rb,
lib/simple_enumeration/collection_methods_definer.rb,
lib/simple_enumeration/collections/custom_factory.rb
Defined Under Namespace
Modules: Collections, DefineSimpleEnumeration, Types
Classes: Collection, CollectionMethodsDefiner, Entity, Type, TypeBuilder, TypeMethodsDefiner
Constant Summary
collapse
- VERSION =
'0.3.1'
Class Method Summary
collapse
Class Method Details
.camelcase(string) ⇒ Object
24
25
26
27
28
29
|
# File 'lib/simple_enumeration.rb', line 24
def self.camelcase(string)
string.split('_').map do |w|
w[0] = w[0].upcase
w
end.join
end
|
.extended(receiver) ⇒ Object
20
21
22
|
# File 'lib/simple_enumeration.rb', line 20
def self.extended(receiver)
receiver.extend DefineSimpleEnumeration
end
|
.underscore(string) ⇒ Object
31
32
33
34
35
36
37
|
# File 'lib/simple_enumeration.rb', line 31
def self.underscore(string)
string
.gsub('::', '/')
.gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
.gsub(/([a-z\d])([A-Z])/, '\1_\2')
.downcase
end
|