Class: Verbalize::Build

Inherits:
Object
  • Object
show all
Defined in:
lib/verbalize/build.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(required_keywords, optional_keywords, default_keywords) ⇒ Build

Returns a new instance of Build.



7
8
9
10
11
# File 'lib/verbalize/build.rb', line 7

def initialize(required_keywords, optional_keywords, default_keywords)
  @required_keywords = required_keywords
  @optional_keywords = optional_keywords
  @default_keywords  = default_keywords
end

Instance Attribute Details

#default_keywordsObject (readonly)

Returns the value of attribute default_keywords.



38
39
40
# File 'lib/verbalize/build.rb', line 38

def default_keywords
  @default_keywords
end

#optional_keywordsObject (readonly)

Returns the value of attribute optional_keywords.



38
39
40
# File 'lib/verbalize/build.rb', line 38

def optional_keywords
  @optional_keywords
end

#required_keywordsObject (readonly)

Returns the value of attribute required_keywords.



38
39
40
# File 'lib/verbalize/build.rb', line 38

def required_keywords
  @required_keywords
end

Class Method Details

.call(required_keywords = [], optional_keywords = [], default_keywords = []) ⇒ Object



3
4
5
# File 'lib/verbalize/build.rb', line 3

def self.call(required_keywords = [], optional_keywords = [], default_keywords = [])
  new(required_keywords, optional_keywords, default_keywords).call
end

Instance Method Details

#callObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/verbalize/build.rb', line 13

def call
  # We have to re-alias `!` to `call!` here, otherwise it will be pointing
  # to the original `call!` method
  <<-CODE
class << self
  def call(#{declaration_arguments_string})
__proxied_call(#{forwarding_arguments_string})
  end

  def call!(#{declaration_arguments_string})
__proxied_call!(#{forwarding_arguments_string})
  end
  alias_method :!, :call!
end

def initialize(#{declaration_arguments_string})
  #{initialize_body}
end

private

attr_reader #{attribute_readers_string}
  CODE
end