Class: Schemify::Keyword
- Inherits:
-
Object
- Object
- Schemify::Keyword
- Defined in:
- lib/schemify/keyword.rb
Overview
Represents a keyword in a schema, which can be used to define metadata or properties
Defined Under Namespace
Modules: Builder
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(value) ⇒ Keyword
constructor
A new instance of Keyword.
- #to_h ⇒ Object
Constructor Details
#initialize(value) ⇒ Keyword
Returns a new instance of Keyword.
8 9 10 |
# File 'lib/schemify/keyword.rb', line 8 def initialize(value) @value = value end |
Class Method Details
.json_name(value = nil, dollar_prefix: false) ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/schemify/keyword.rb', line 17 def json_name(value = nil, dollar_prefix: false) return @json_name if value.nil? @json_name = if dollar_prefix "$#{Naming.json_name(value)}" else Naming.json_name(value) end end |
Instance Method Details
#to_h ⇒ Object
12 13 14 |
# File 'lib/schemify/keyword.rb', line 12 def to_h { self.class.json_name => @value } end |