Class: TentCanonicalJson
- Inherits:
-
Object
- Object
- TentCanonicalJson
- Defined in:
- lib/tent-canonical-json.rb,
lib/tent-canonical-json/version.rb
Constant Summary collapse
- REMOVE =
%w[ /permissions /received_at /version/received_at /version/id ].freeze
- REMOVE_MATCHING =
{ "/mentions/*/public" => false }.freeze
- MOVE =
{ "/original_entity" => "/entity", "/mentions/*/original_entity" => "/mentions/{index}/entity", "/version/parents/*/original_entity" => "/version/parents/{index}/entity" }.freeze
- REMOVE_EMPTY =
%w[ /app /attachments /mentions /content /licenses /version/parents /version/message /version ].freeze
- REMOVE_MATCHING_PATHS =
{ "/version/parents/*/post" => "/id", "/version/parents/*/entity" => "/entity", "/mentions/*/post" => "/id", "/mentions/*/entity" => "/entity" }.freeze
- VERSION =
"0.0.1"
Class Method Summary collapse
Instance Method Summary collapse
- #encode ⇒ Object
-
#initialize(post) ⇒ TentCanonicalJson
constructor
A new instance of TentCanonicalJson.
Constructor Details
#initialize(post) ⇒ TentCanonicalJson
Returns a new instance of TentCanonicalJson.
27 28 29 |
# File 'lib/tent-canonical-json.rb', line 27 def initialize(post) @post = stringify_keys(post.dup) end |
Class Method Details
.encode(post) ⇒ Object
23 24 25 |
# File 'lib/tent-canonical-json.rb', line 23 def self.encode(post) new(post).encode end |
Instance Method Details
#encode ⇒ Object
31 32 33 34 |
# File 'lib/tent-canonical-json.rb', line 31 def encode cleanup sorted_encode end |