Class: ExampleTodoListComponent::TodoItemResource
- Inherits:
-
Object
- Object
- ExampleTodoListComponent::TodoItemResource
- Includes:
- JsonSchemaView::JsonSchemaDefinable
- Defined in:
- lib/json_schema_view/rails/generators/install/templates/example/todo_item_resource.rb
Overview
This is an example definition of a resource.
A class that includes JsonSchemaView::JsonSchemaDefinable can generate its JSON Schema and it can be used as a type in another resource’s property.
Instance Method Summary collapse
-
#done ⇒ Boolean
Whether the TODO item is done or not.
-
#initialize(todo_item) ⇒ TodoItemResource
constructor
A new instance of TodoItemResource.
- #note ⇒ Object
-
#title ⇒ String
The title of TODO item.
Methods included from JsonSchemaView::JsonWorldExtensions::Validatable
Methods included from JsonSchemaView::JsonWorldExtensions::CompactOptionalProperties
Constructor Details
#initialize(todo_item) ⇒ TodoItemResource
Returns a new instance of TodoItemResource.
33 34 35 |
# File 'lib/json_schema_view/rails/generators/install/templates/example/todo_item_resource.rb', line 33 def initialize(todo_item) @todo_item = todo_item end |
Instance Method Details
#done ⇒ Boolean
Returns Whether the TODO item is done or not.
43 44 45 |
# File 'lib/json_schema_view/rails/generators/install/templates/example/todo_item_resource.rb', line 43 def done @todo_item[:done] end |
#note ⇒ Object
48 49 50 |
# File 'lib/json_schema_view/rails/generators/install/templates/example/todo_item_resource.rb', line 48 def note @todo_item[:note] end |
#title ⇒ String
Returns The title of TODO item.
38 39 40 |
# File 'lib/json_schema_view/rails/generators/install/templates/example/todo_item_resource.rb', line 38 def title @todo_item[:title] end |