Module: Anchor::Types
- Defined in:
- lib/anchor/types.rb
Defined Under Namespace
Modules: Inference
Classes: Array, BigDecimal, Boolean, Enum, Float, Integer, Literal, Maybe, Null, Object, Property, Record, Reference, Relationship, String, Union, Unknown
Class Method Summary
collapse
Class Method Details
.camelize_without_inflection(val) ⇒ Object
64
65
66
67
68
69
70
71
|
# File 'lib/anchor/types.rb', line 64
def self.camelize_without_inflection(val)
vals = val.split("_")
if vals.length == 1
vals[0]
else
([vals[0]] + vals[1..].map(&:capitalize)).join("")
end
end
|
.convert_case(value) ⇒ String
75
76
77
78
79
80
81
82
83
|
# File 'lib/anchor/types.rb', line 75
def self.convert_case(value)
case Anchor.config.field_case
when :camel then value.to_s.underscore.camelize(:lower)
when :camel_without_inflection then camelize_without_inflection(value.to_s.underscore)
when :kebab then value.to_s.underscore.dasherize
when :snake then value.to_s.underscore
else value
end
end
|