Module: StormForge::Dsl::TestCase::AttributeAccess

Included in:
Cloud, DataSource::FileFixture, Definition, Session
Defined in:
lib/stormforge/dsl/test_case/attribute_access.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(meth, *args, &block) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/stormforge/dsl/test_case/attribute_access.rb', line 2

def method_missing(meth, *args, &block)
  if available_attributes.include? meth
    case args.size
    when 0 then @attributes[meth]
    when 1 then @attributes[meth] = args.first
    else raise ArgumentError
    end
  elsif available_attributes.map {|a| "#{a}=".to_sym }.include? meth
    @attributes[meth.to_s.split("=").first.to_sym] = args.first
  else
    super
  end
end

Instance Method Details

#respond_to_missing?(meth, *args, &blk) ⇒ Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/stormforge/dsl/test_case/attribute_access.rb', line 16

def respond_to_missing?(meth, *args, &blk)
  available_attributes.include? meth
end