Class: Nukumber::Model::Feature

Inherits:
Object
  • Object
show all
Defined in:
lib/nukumber/model/feature.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, line, description, file_path) ⇒ Feature

Returns a new instance of Feature.



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/nukumber/model/feature.rb', line 9

def initialize(name, line, description, file_path)
  if name.length == 0
    raise "Features must be named (#{file_path}:#{line})"
  elsif name[0,1] !~ /[a-zA-Z]/
    raise "Feature names must begin with a letter (#{file_path}:#{line})"
  end
  @name, @line, @description = name, line, description
  @feature_elements, @tags = [], []
  @background = nil
  @file_path = file_path
end

Instance Attribute Details

#backgroundObject

Returns the value of attribute background.



7
8
9
# File 'lib/nukumber/model/feature.rb', line 7

def background
  @background
end

#descriptionObject (readonly)

Returns the value of attribute description.



6
7
8
# File 'lib/nukumber/model/feature.rb', line 6

def description
  @description
end

#feature_elementsObject

Returns the value of attribute feature_elements.



7
8
9
# File 'lib/nukumber/model/feature.rb', line 7

def feature_elements
  @feature_elements
end

#file_pathObject (readonly)

Returns the value of attribute file_path.



6
7
8
# File 'lib/nukumber/model/feature.rb', line 6

def file_path
  @file_path
end

#lineObject (readonly)

Returns the value of attribute line.



6
7
8
# File 'lib/nukumber/model/feature.rb', line 6

def line
  @line
end

#nameObject (readonly)

Returns the value of attribute name.



6
7
8
# File 'lib/nukumber/model/feature.rb', line 6

def name
  @name
end

#tagsObject

Returns the value of attribute tags.



7
8
9
# File 'lib/nukumber/model/feature.rb', line 7

def tags
  @tags
end

Instance Method Details

#keywordObject



21
22
23
# File 'lib/nukumber/model/feature.rb', line 21

def keyword
  'Feature'
end

#to_sObject



25
26
27
# File 'lib/nukumber/model/feature.rb', line 25

def to_s
  "#{keyword} \"#{name}\""
end