Class: Osheet::PartialSet

Inherits:
Hash
  • Object
show all
Defined in:
lib/osheet/partial_set.rb

Direct Known Subclasses

TemplateSet

Instance Method Summary collapse

Constructor Details

#initializePartialSet

this class is a Hash that behaves kinda like a set. I want to

push partials into the set using the '<<' operator, only allow
Osheet::Partial objs to be pushed, and then be able to reference
a particular partial using a key


11
12
13
# File 'lib/osheet/partial_set.rb', line 11

def initialize
  super
end

Instance Method Details

#<<(partial) ⇒ Object



15
16
17
18
19
# File 'lib/osheet/partial_set.rb', line 15

def <<(partial)
  if (key = verify(partial))
    push(key, partial)
  end
end

#get(name) ⇒ Object

return the named partial



22
23
24
# File 'lib/osheet/partial_set.rb', line 22

def get(name)
  lookup(key(name.to_s))
end