Class: Natsukantou::Setup::Component

Inherits:
Object
  • Object
show all
Defined in:
lib/natsukantou/setup/config_prompt.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, path) ⇒ Component

Returns a new instance of Component.



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/natsukantou/setup/config_prompt.rb', line 20

def initialize(name, path)
  @name = name

  YARD.parse(path)

  @klass = YARD::Registry.all.find do |item|
    item.type == :class && item.name == name
  end

  @initialize_method = klass.meths.find do |item|
    item.type == :method && item.name == :initialize
  end

  @initialize_method_param_tags = @initialize_method.tags('param')
    .reject { |tag| tag.name == 'app' }
    .map { |tag| MethodParamTagDecorator.new(tag) }

  YARD::Registry.clear
end

Instance Attribute Details

#initialize_methodObject (readonly)

Returns the value of attribute initialize_method.



17
18
19
# File 'lib/natsukantou/setup/config_prompt.rb', line 17

def initialize_method
  @initialize_method
end

#initialize_method_param_tagsObject (readonly)

Returns the value of attribute initialize_method_param_tags.



17
18
19
# File 'lib/natsukantou/setup/config_prompt.rb', line 17

def initialize_method_param_tags
  @initialize_method_param_tags
end

#klassObject (readonly)

Returns the value of attribute klass.



17
18
19
# File 'lib/natsukantou/setup/config_prompt.rb', line 17

def klass
  @klass
end

#nameObject (readonly)

Returns the value of attribute name.



17
18
19
# File 'lib/natsukantou/setup/config_prompt.rb', line 17

def name
  @name
end