Module: Ronin::Code::SQL::Fields

Included in:
Clause, InjectionExpr, StatementList
Defined in:
lib/ronin/code/sql/fields.rb

Overview

Allows creating Fields via #method_missing.

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *arguments, &block) ⇒ Field (protected)

Allows specifying databases, tables or columns.

Examples:

db.users
users.id

Parameters:

  • name (Symbol)

    The field name to access.

  • arguments (Array)

    Additional method arguments.

Returns:

  • (Field)

    The field object.



72
73
74
75
76
77
78
# File 'lib/ronin/code/sql/fields.rb', line 72

def method_missing(name,*arguments,&block)
  if (arguments.empty? && block.nil?)
    Field.new(name)
  else
    super
  end
end

Instance Method Details

#respond_to_missing?(name, include_private) ⇒ true

Specifies that #method_missing will catch all missing methods.

Parameters:

  • name (Symbol)

    The method name that is being checked.

  • include_private (Boolean)

Returns:

  • (true)


42
43
44
# File 'lib/ronin/code/sql/fields.rb', line 42

def respond_to_missing?(name,include_private)
  true
end

#to_arynil

Returns:

  • (nil)


49
50
# File 'lib/ronin/code/sql/fields.rb', line 49

def to_ary
end