Class: Lipa::Kind

Inherits:
Object
  • Object
show all
Defined in:
lib/lipa/kind.rb

Overview

Implemenation of kind(template) for description

Examples:

tree = root :tree do 
  kind :some_kind do
    param1 "some_param"
  end

  some_kind :some_instance 
end
tree["some_instance"].param_1 #=> "some_param"

See Also:

  • Tree#kind

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, attrs = {}, &block) ⇒ Kind

Returns a new instance of Kind.



42
43
44
45
46
47
48
49
# File 'lib/lipa/kind.rb', line 42

def initialize(name, attrs = {}, &block)
  @for =  attrs.delete(:for)
  @for ||= :node

  @attrs = attrs
  @name = name.to_sym
  @block = block if block_given?
end

Instance Attribute Details

#attrsObject (readonly)

Returns the value of attribute attrs.



41
42
43
# File 'lib/lipa/kind.rb', line 41

def attrs
  @attrs
end

#blockObject (readonly)

Returns the value of attribute block.



41
42
43
# File 'lib/lipa/kind.rb', line 41

def block
  @block
end

#forObject (readonly)

Returns the value of attribute for.



41
42
43
# File 'lib/lipa/kind.rb', line 41

def for
  @for
end

#nameObject (readonly)

Returns the value of attribute name.



41
42
43
# File 'lib/lipa/kind.rb', line 41

def name
  @name
end