Class: Schron::GenericEntity

Inherits:
Object
  • Object
show all
Defined in:
lib/schron/generic_entity.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attrs = {}) ⇒ GenericEntity

Returns a new instance of GenericEntity.



6
7
8
# File 'lib/schron/generic_entity.rb', line 6

def initialize(attrs={})
  @attributes = attrs
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/schron/generic_entity.rb', line 10

def method_missing(method, *args)
  if args.empty? && @attributes.key?(method)
    @attributes[method]
  else
    super
  end
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



4
5
6
# File 'lib/schron/generic_entity.rb', line 4

def attributes
  @attributes
end