Module: Hecks::IR::Declares

Defined in:
lib/hecks/ir.rb

Instance Method Summary collapse

Instance Method Details

#emits_ir(**spec) ⇒ Object



77
78
79
# File 'lib/hecks/ir.rb', line 77

def emits_ir(**spec)
  @ir_spec = spec
end

#ir_specObject

Walks the superclass chain so a Class.new(ValueObject) — which is what every declared value object actually IS — inherits the shape its base declared, rather than each anonymous subclass having to redeclare it.



88
89
90
91
92
# File 'lib/hecks/ir.rb', line 88

def ir_spec
  return @ir_spec if defined?(@ir_spec) && @ir_spec

  superclass.ir_spec if respond_to?(:superclass) && superclass.respond_to?(:ir_spec)
end

#many(source) ⇒ Object



81
# File 'lib/hecks/ir.rb', line 81

def many(source) = Many.new(source)

#one(source) ⇒ Object



82
# File 'lib/hecks/ir.rb', line 82

def one(source)  = One.new(source)