Class: GhostRb::Resources::BaseResource

Inherits:
Object
  • Object
show all
Includes:
Support::Hydratable
Defined in:
lib/ghost_rb/resources/base_resource.rb

Overview

Author:

  • Rene Hernandez

Since:

  • 0.1

Direct Known Subclasses

Post, Tag, User

Class Method Summary collapse

Methods included from Support::Hydratable

#hydrate

Class Method Details

.generate(hash) ⇒ Object

Since:

  • 0.1



12
13
14
15
16
# File 'lib/ghost_rb/resources/base_resource.rb', line 12

def self.generate(hash)
  res_instance = new
  res_instance.hydrate(hash)
  res_instance
end

.hash_value?(data, key) ⇒ Boolean

Returns:

  • (Boolean)

Since:

  • 0.1



18
19
20
# File 'lib/ghost_rb/resources/base_resource.rb', line 18

def self.hash_value?(data, key)
  data.key?(key) && data[key].is_a?(Hash)
end