MCPcopy
hub / github.com/hashicorp/hcl / Blocks

Method Blocks

hclwrite/ast_body.go:64–72  ·  view source on GitHub ↗

Blocks returns a new slice of all the blocks in the body.

()

Source from the content-addressed store, hash-verified

62
63// Blocks returns a new slice of all the blocks in the body.
64func (b *Body) Blocks() []*Block {
65 ret := make([]*Block, 0, len(b.items))
66 for _, n := range b.items.List() {
67 if block, isBlock := n.content.(*Block); isBlock {
68 ret = append(ret, block)
69 }
70 }
71 return ret
72}
73
74// GetAttribute returns the attribute from the body that has the given name,
75// or returns nil if there is currently no matching attribute.

Callers 3

FirstMatchingBlockMethod · 0.95
TestBlockTypeFunction · 0.80
TestBlockLabelsFunction · 0.80

Implementers 8

Bodyhclsyntax/structure.go
unknownBodyext/dynblock/unknown_body.go
expandBodyext/dynblock/expand_body.go
deepWrapperext/transform/transform.go
diagBodyext/transform/error.go
bodyjson/structure.go
mockBodyhcltest/mock.go

Calls 1

ListMethod · 0.80

Tested by 2

TestBlockTypeFunction · 0.64
TestBlockLabelsFunction · 0.64