Module: Hefted::ClassMethod

Defined in:
lib/hefted/class_method.rb

Instance Method Summary collapse

Instance Method Details

#hefted(**args) ⇒ Object



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

def hefted(**args)
  arguments = const_join(args)
  template = Base.new(*arguments.keys)
  self.const_set(arguments.name, template.new(*arguments.values).freeze)
end

#release_hefted(*names) ⇒ Object



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

def release_hefted(*names)
  names.each do |name|
    remove_const(name.to_camel) if const_defined?(name.to_camel)
  end
end