Class: Thyng

Inherits:
Hash
  • Object
show all
Defined in:
lib/thyng.rb,
lib/thyng/version.rb,
lib/thyng/crypted_aspect.rb

Defined Under Namespace

Modules: CryptedAspect

Constant Summary collapse

VERSION =
"0.1.0"

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ Thyng

Returns a new instance of Thyng.



5
6
7
8
9
# File 'lib/thyng.rb', line 5

def initialize(args={})
  args.each{ |attribute, value|
    send("#{attribute}=", value)
  }
end

Class Method Details

.aspect_accessor(aspect) ⇒ Object



23
24
25
26
# File 'lib/thyng.rb', line 23

def self.aspect_accessor aspect
  aspect_reader aspect
  aspect_writer aspect
end

.aspect_reader(aspect) ⇒ Object



17
18
19
20
21
# File 'lib/thyng.rb', line 17

def self.aspect_reader aspect
  define_method aspect, -> {
    fetch(aspect)
  }
end

.aspect_writer(aspect) ⇒ Object



11
12
13
14
15
# File 'lib/thyng.rb', line 11

def self.aspect_writer aspect
  define_method "#{aspect}=", ->(value) {
    self[aspect] = value
  }
end