Class: DevelopWithPassion::Arrays::Dsl

Inherits:
Object
  • Object
show all
Defined in:
lib/developwithpassion_arrays/dsl.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Dsl

Returns a new instance of Dsl.



6
7
8
9
10
# File 'lib/developwithpassion_arrays/dsl.rb', line 6

def initialize(name)
  @name = name
  initialize_arrays :mutators,:visitors,:criteria
  initialize_false :writable,:readable
end

Instance Attribute Details

#criteriaObject

Returns the value of attribute criteria.



4
5
6
# File 'lib/developwithpassion_arrays/dsl.rb', line 4

def criteria
  @criteria
end

#mutatorsObject

Returns the value of attribute mutators.



4
5
6
# File 'lib/developwithpassion_arrays/dsl.rb', line 4

def mutators
  @mutators
end

#nameObject

Returns the value of attribute name.



4
5
6
# File 'lib/developwithpassion_arrays/dsl.rb', line 4

def name
  @name
end

#readableObject

Returns the value of attribute readable.



4
5
6
# File 'lib/developwithpassion_arrays/dsl.rb', line 4

def readable
  @readable
end

#visitorsObject

Returns the value of attribute visitors.



4
5
6
# File 'lib/developwithpassion_arrays/dsl.rb', line 4

def visitors
  @visitors
end

#writableObject

Returns the value of attribute writable.



4
5
6
# File 'lib/developwithpassion_arrays/dsl.rb', line 4

def writable
  @writable
end

Instance Method Details

#mutator(*names, &block) ⇒ Object



12
13
14
# File 'lib/developwithpassion_arrays/dsl.rb', line 12

def mutator(*names,&block)
  names.each{|name| @mutators.push(MutatorDetail.new(name,block))}
end

#new_item_must(criteria, fail_option) ⇒ Object



16
17
18
# File 'lib/developwithpassion_arrays/dsl.rb', line 16

def new_item_must(criteria,fail_option)
  @criteria.push(AddCriterion.new(criteria,fail_option))
end

#process_using(name, visitor) ⇒ Object



20
21
22
# File 'lib/developwithpassion_arrays/dsl.rb', line 20

def process_using(name,visitor)
  @visitors.push(VisitorDetail.new(name,visitor))
end

#read_and_writeObject



24
25
26
27
# File 'lib/developwithpassion_arrays/dsl.rb', line 24

def read_and_write
  writable
  readable
end