Class: Services::Entity
- Inherits:
-
Object
- Object
- Services::Entity
- Defined in:
- lib/services/entity.rb
Overview
entity base class. member,service,endpoint are all “services::entity”
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
-
#initialize(name, args = {}) ⇒ Entity
constructor
A new instance of Entity.
- #load ⇒ Object
- #store ⇒ Object (also: #save)
- #to_hash ⇒ Object
Constructor Details
#initialize(name, args = {}) ⇒ Entity
Returns a new instance of Entity.
12 13 14 15 |
# File 'lib/services/entity.rb', line 12 def initialize(name, args = {}) @name = name validate end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
11 12 13 |
# File 'lib/services/entity.rb', line 11 def name @name end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
11 12 13 |
# File 'lib/services/entity.rb', line 11 def path @path end |
Instance Method Details
#load ⇒ Object
22 23 24 |
# File 'lib/services/entity.rb', line 22 def load _load end |
#store ⇒ Object Also known as: save
17 18 19 |
# File 'lib/services/entity.rb', line 17 def store _store end |
#to_hash ⇒ Object
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/services/entity.rb', line 26 def to_hash vars = {} instance_variables.each do |name| key = name[1..-1].to_s # don't store "path" next if key == 'path' vars[key] = instance_variable_get(name).to_s end vars end |