Class: Namo::Formulae

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/Namo/Formulae.rb

Instance Method Summary collapse

Methods included from Enumerable

#drop, #drop_while, #first, #group_by, #last, #partition, #select, #sort_by, #take, #take_while, #uniq

Instance Method Details

#==(other) ⇒ Object



53
54
55
# File 'lib/Namo/Formulae.rb', line 53

def ==(other)
  other.is_a?(Formulae) && keys.sort == other.keys.sort
end

#[](name) ⇒ Object



8
9
10
# File 'lib/Namo/Formulae.rb', line 8

def [](name)
  @store[name]
end

#[]=(name, callable) ⇒ Object



12
13
14
# File 'lib/Namo/Formulae.rb', line 12

def []=(name, callable)
  @store[name] = callable
end

#delete(name) ⇒ Object



33
34
35
# File 'lib/Namo/Formulae.rb', line 33

def delete(name)
  @store.delete(name)
end

#dupObject



45
46
47
# File 'lib/Namo/Formulae.rb', line 45

def dup
  self.class.new(@store.dup)
end

#each(&block) ⇒ Object



28
29
30
31
# File 'lib/Namo/Formulae.rb', line 28

def each(&block)
  return enum_for(:each) unless block_given?
  @store.each(&block)
end

#empty?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/Namo/Formulae.rb', line 24

def empty?
  @store.empty?
end

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


57
58
59
# File 'lib/Namo/Formulae.rb', line 57

def eql?(other)
  self == other
end

#hashObject



61
62
63
# File 'lib/Namo/Formulae.rb', line 61

def hash
  keys.sort.hash
end

#key?(name) ⇒ Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/Namo/Formulae.rb', line 20

def key?(name)
  @store.key?(name)
end

#keysObject



16
17
18
# File 'lib/Namo/Formulae.rb', line 16

def keys
  @store.keys
end

#merge(other) ⇒ Object



37
38
39
# File 'lib/Namo/Formulae.rb', line 37

def merge(other)
  self.class.new(@store.merge(other.to_h))
end

#reject(&block) ⇒ Object



41
42
43
# File 'lib/Namo/Formulae.rb', line 41

def reject(&block)
  self.class.new(@store.reject(&block))
end

#to_hObject



49
50
51
# File 'lib/Namo/Formulae.rb', line 49

def to_h
  @store.dup
end