Class: GDK::ConfigType::Builder

Inherits:
Object
  • Object
show all
Defined in:
lib/gdk/config_type/builder.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(key:, klass:, **kwargs, &blk) ⇒ Builder

Returns a new instance of Builder.



8
9
10
11
12
13
# File 'lib/gdk/config_type/builder.rb', line 8

def initialize(key:, klass:, **kwargs, &blk)
  @key = key
  @klass = klass
  @kwargs = kwargs
  @blk = blk
end

Instance Attribute Details

#blkObject (readonly)

Returns the value of attribute blk.



6
7
8
# File 'lib/gdk/config_type/builder.rb', line 6

def blk
  @blk
end

#keyObject (readonly)

Returns the value of attribute key.



6
7
8
# File 'lib/gdk/config_type/builder.rb', line 6

def key
  @key
end

#klassObject (readonly)

Returns the value of attribute klass.



6
7
8
# File 'lib/gdk/config_type/builder.rb', line 6

def klass
  @klass
end

#kwargsObject (readonly)

Returns the value of attribute kwargs.



6
7
8
# File 'lib/gdk/config_type/builder.rb', line 6

def kwargs
  @kwargs
end

Instance Method Details

#build(parent:) ⇒ Object



19
20
21
# File 'lib/gdk/config_type/builder.rb', line 19

def build(parent:)
  klass.new(parent: parent, builder: self, **kwargs)
end

#ignore?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/gdk/config_type/builder.rb', line 15

def ignore?
  key.start_with?('__') || key.end_with?('?')
end