-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
51e39a6
commit e91160f
Showing
9 changed files
with
81 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
require "json" | ||
|
||
module Shivneri | ||
module MODEL | ||
class Body | ||
JSON.mapping( | ||
body_data: Hash(String, JSON::Any) | ||
) | ||
setter body_data | ||
|
||
@body_data : Hash(String, JSON::Any) | ||
|
||
def initialize(@body_data) | ||
end | ||
|
||
def to_tuple(value) | ||
return convert_to_tuple(value) | ||
end | ||
|
||
macro convert_to_tuple(value) | ||
return {{value}}.get_tuple_from_hash_json_any.call(@body_data) | ||
end | ||
|
||
def as_hash | ||
return @body_data | ||
end | ||
|
||
def [](key : String) | ||
return @body_data[key] | ||
end | ||
|
||
def []=(key : String, value) | ||
@body_data[key] = value | ||
end | ||
|
||
def merge(hash) | ||
@body_data.merge!(hash) | ||
end | ||
|
||
def has_key(key : String) | ||
@body_data.has_key?(key) | ||
end | ||
|
||
def has_key?(key : String) | ||
@body_data.has_key?(key) | ||
end | ||
|
||
# def to_json | ||
# return @body_data.to_json | ||
# end | ||
|
||
# def to_json(value : JSON::Builder) | ||
# return @body_data.to_json | ||
# end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,3 +9,4 @@ require "./http_file" | |
require "./view_engine_data" | ||
require "./view_read_option" | ||
require "./fort" | ||
require "./body" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters