Module: Broach::Attributes

Included in:
Room, Session, User
Defined in:
lib/broach/attributes.rb

Overview

Makes a very simple attribute driven model from the class when included.

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *arguments, &block) ⇒ Object



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

def method_missing(method, *arguments, &block)
  if value = @attributes[method.to_s]
    value
  else
    super
  end
end

Instance Method Details

#idObject



8
# File 'lib/broach/attributes.rb', line 8

def id; @attributes['id']; end

#initialize(attributes) ⇒ Object



4
5
6
# File 'lib/broach/attributes.rb', line 4

def initialize(attributes)
  @attributes = attributes
end