Class: ConcernBuilder

Inherits:
Object
  • Object
show all
Includes:
OptionsParser
Defined in:
lib/concern_builder.rb,
lib/concern_builder/version.rb

Defined Under Namespace

Modules: OptionsParser

Constant Summary collapse

VERSION =
'0.0.3'

Instance Attribute Summary collapse

Attributes included from OptionsParser

#options

Instance Method Summary collapse

Methods included from OptionsParser

#options_object

Constructor Details

#initialize(attr_names, instance, options = {}) ⇒ ConcernBuilder

Returns a new instance of ConcernBuilder.



12
13
14
15
16
17
18
# File 'lib/concern_builder.rb', line 12

def initialize(attr_names, instance, options = {})
  @attr_names = attr_names
  @instance = instance
  @options = options
  @methods_def = []
  init
end

Instance Attribute Details

#attr_names ⇒ Object (readonly)

Returns the value of attribute attr_names.



10
11
12
# File 'lib/concern_builder.rb', line 10

def attr_names
  @attr_names
end

#methods_def ⇒ Object (readonly)

Returns the value of attribute methods_def.



10
11
12
# File 'lib/concern_builder.rb', line 10

def methods_def
  @methods_def
end

Instance Method Details

#build ⇒ Object



20
21
22
23
24
# File 'lib/concern_builder.rb', line 20

def build
  methods_def.each do |method_def|
    @instance.module_eval(method_def, __FILE__, __LINE__ + 1)
  end
end