GRAYBYTE WORDPRESS FILE MANAGER4436

Server IP : 198.54.121.189 / Your IP : 216.73.216.140
System : Linux premium69.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64
PHP Version : 7.4.33
Disable Function : NONE
cURL : ON | WGET : ON | Sudo : OFF | Pkexec : OFF
Directory : /opt/alt/ruby20/lib64/ruby/2.0.0/rdoc/
Upload Files :
Current_dir [ Not Writeable ] Document_root [ Writeable ]

Command :


Current File : /opt/alt/ruby20/lib64/ruby/2.0.0/rdoc//method_attr.rb
##
# Abstract class representing either a method or an attribute.

class RDoc::MethodAttr < RDoc::CodeObject

  include Comparable

  ##
  # Name of this method/attribute.

  attr_accessor :name

  ##
  # public, protected, private

  attr_accessor :visibility

  ##
  # Is this a singleton method/attribute?

  attr_accessor :singleton

  ##
  # Source file token stream

  attr_reader :text

  ##
  # Array of other names for this method/attribute

  attr_reader :aliases

  ##
  # The method/attribute we're aliasing

  attr_accessor :is_alias_for

  #--
  # The attributes below are for AnyMethod only.
  # They are left here for the time being to
  # allow ri to operate.
  # TODO modify ri to avoid calling these on attributes.
  #++

  ##
  # Parameters yielded by the called block

  attr_reader :block_params

  ##
  # Parameters for this method

  attr_accessor :params

  ##
  # Different ways to call this method

  attr_accessor :call_seq

  ##
  # The call_seq or the param_seq with method name, if there is no call_seq.

  attr_reader :arglists

  ##
  # Pretty parameter list for this method

  attr_reader :param_seq


  ##
  # Creates a new MethodAttr from token stream +text+ and method or attribute
  # name +name+.
  #
  # Usually this is called by super from a subclass.

  def initialize text, name
    super()

    @text = text
    @name = name

    @aliases      = []
    @is_alias_for = nil
    @parent_name  = nil
    @singleton    = nil
    @visibility   = :public
    @see = false

    @arglists     = nil
    @block_params = nil
    @call_seq     = nil
    @param_seq    = nil
    @params       = nil
  end

  ##
  # Order by #singleton then #name

  def <=>(other)
    [     @singleton ? 0 : 1,       name] <=>
    [other.singleton ? 0 : 1, other.name]
  end

  def == other # :nodoc:
    super or self.class == other.class and full_name == other.full_name
  end

  ##
  # A method/attribute is documented if any of the following is true:
  # - it was marked with :nodoc:;
  # - it has a comment;
  # - it is an alias for a documented method;
  # - it has a +#see+ method that is documented.

  def documented?
    super or
      (is_alias_for and is_alias_for.documented?) or
      (see and see.documented?)
  end

  ##
  # A method/attribute to look at,
  # in particular if this method/attribute has no documentation.
  #
  # It can be a method/attribute of the superclass or of an included module,
  # including the Kernel module, which is always appended to the included
  # modules.
  #
  # Returns +nil+ if there is no such method/attribute.
  # The +#is_alias_for+ method/attribute, if any, is not included.
  #
  # Templates may generate a "see also ..." if this method/attribute
  # has documentation, and "see ..." if it does not.

  def see
    @see = find_see if @see == false
    @see
  end

  ##
  # Sets the store for this class or module and its contained code objects.

  def store= store
    super

    @file = @store.add_file @file.full_name if @file
  end

  def find_see # :nodoc:
    return nil if singleton || is_alias_for

    # look for the method
    other = find_method_or_attribute name
    return other if other

    # if it is a setter, look for a getter
    return nil unless name =~ /[a-z_]=$/i   # avoid == or ===
    return find_method_or_attribute name[0..-2]
  end

  def find_method_or_attribute name # :nodoc:
    return nil unless parent.respond_to? :ancestors

    searched = parent.ancestors
    kernel = @store.modules_hash['Kernel']

    searched << kernel if kernel &&
      parent != kernel && !searched.include?(kernel)

    searched.each do |ancestor|
      next if parent == ancestor
      next if String === ancestor

      other = ancestor.find_method_named('#' << name) ||
              ancestor.find_attribute_named(name)

      return other if other
    end

    nil
  end

  ##
  # Abstract method. Contexts in their building phase call this
  # to register a new alias for this known method/attribute.
  #
  # - creates a new AnyMethod/Attribute named <tt>an_alias.new_name</tt>;
  # - adds +self+ as an alias for the new method or attribute
  # - adds the method or attribute to #aliases
  # - adds the method or attribute to +context+.

  def add_alias(an_alias, context)
    raise NotImplementedError
  end

  ##
  # HTML fragment reference for this method

  def aref
    type = singleton ? 'c' : 'i'
    # % characters are not allowed in html names => dash instead
    "#{aref_prefix}-#{type}-#{html_name}"
  end

  ##
  # Prefix for +aref+, defined by subclasses.

  def aref_prefix
    raise NotImplementedError
  end

  ##
  # Attempts to sanitize the content passed by the ruby parser:
  # remove outer parentheses, etc.

  def block_params=(value)
    # 'yield.to_s' or 'assert yield, msg'
    return @block_params = '' if value =~ /^[\.,]/

    # remove trailing 'if/unless ...'
    return @block_params = '' if value =~ /^(if|unless)\s/

    value = $1.strip if value =~ /^(.+)\s(if|unless)\s/

    # outer parentheses
    value = $1 if value =~ /^\s*\((.*)\)\s*$/
    value = value.strip

    # proc/lambda
    return @block_params = $1 if value =~ /^(proc|lambda)(\s*\{|\sdo)/

    # surrounding +...+ or [...]
    value = $1.strip if value =~ /^\+(.*)\+$/
    value = $1.strip if value =~ /^\[(.*)\]$/

    return @block_params = '' if value.empty?

    # global variable
    return @block_params = 'str' if value =~ /^\$[&0-9]$/

    # wipe out array/hash indices
    value.gsub!(/(\w)\[[^\[]+\]/, '\1')

    # remove @ from class/instance variables
    value.gsub!(/@@?([a-z0-9_]+)/, '\1')

    # method calls => method name
    value.gsub!(/([A-Z:a-z0-9_]+)\.([a-z0-9_]+)(\s*\(\s*[a-z0-9_.,\s]*\s*\)\s*)?/) do
      case $2
      when 'to_s'      then $1
      when 'const_get' then 'const'
      when 'new' then
        $1.split('::').last.  # ClassName => class_name
          gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
          gsub(/([a-z\d])([A-Z])/,'\1_\2').
          downcase
      else
        $2
      end
    end

    # class prefixes
    value.gsub!(/[A-Za-z0-9_:]+::/, '')

    # simple expressions
    value = $1 if value =~ /^([a-z0-9_]+)\s*[-*+\/]/

    @block_params = value.strip
  end

  ##
  # HTML id-friendly method/attribute name

  def html_name
    require 'cgi'

    CGI.escape(@name.gsub('-', '-2D')).gsub('%','-').sub(/^-/, '')
  end

  ##
  # Full method/attribute name including namespace

  def full_name
    @full_name ||= "#{parent_name}#{pretty_name}"
  end

  def inspect # :nodoc:
    alias_for = @is_alias_for ? " (alias for #{@is_alias_for.name})" : nil
    visibility = self.visibility
    visibility = "forced #{visibility}" if force_documentation
    "#<%s:0x%x %s (%s)%s>" % [
      self.class, object_id,
      full_name,
      visibility,
      alias_for,
    ]
  end

  ##
  # '::' for a class method/attribute, '#' for an instance method.

  def name_prefix
    @singleton ? '::' : '#'
  end

  ##
  # Name for output to HTML.  For class methods the full name with a "." is
  # used like +SomeClass.method_name+.  For instance methods the class name is
  # used if +context+ does not match the parent.
  #
  # This is to help prevent people from using :: to call class methods.

  def output_name context
    return "#{name_prefix}#{@name}" if context == parent

    "#{parent_name}#{@singleton ? '.' : '#'}#{@name}"
  end

  ##
  # Method/attribute name with class/instance indicator

  def pretty_name
    "#{name_prefix}#{@name}"
  end

  ##
  # Type of method/attribute (class or instance)

  def type
    singleton ? 'class' : 'instance'
  end

  ##
  # Path to this method for use with HTML generator output.

  def path
    "#{@parent.path}##{aref}"
  end

  ##
  # Name of our parent with special handling for un-marshaled methods

  def parent_name
    @parent_name || super
  end

  def pretty_print q # :nodoc:
    alias_for = @is_alias_for ? "alias for #{@is_alias_for.name}" : nil

    q.group 2, "[#{self.class.name} #{full_name} #{visibility}", "]" do
      if alias_for then
        q.breakable
        q.text alias_for
      end

      if text then
        q.breakable
        q.text "text:"
        q.breakable
        q.pp @text
      end

      unless comment.empty? then
        q.breakable
        q.text "comment:"
        q.breakable
        q.pp @comment
      end
    end
  end

  ##
  # Used by RDoc::Generator::JsonIndex to create a record for the search
  # engine.

  def search_record
    [
      @name,
      full_name,
      @name,
      @parent.full_name,
      path,
      params,
      snippet(@comment),
    ]
  end

  def to_s # :nodoc:
    if @is_alias_for
      "#{self.class.name}: #{full_name} -> #{is_alias_for}"
    else
      "#{self.class.name}: #{full_name}"
    end
  end

end


[ Back ]
Name
Size
Last Modified
Owner / Group
Permissions
Options
..
--
March 03 2024 22:53:08
root / root
0755
context
--
March 03 2024 22:43:41
root / linksafe
0755
generator
--
March 03 2024 22:43:41
root / linksafe
0755
markdown
--
March 03 2024 22:43:41
root / linksafe
0755
markup
--
March 03 2024 22:43:41
root / linksafe
0755
parser
--
March 03 2024 22:43:41
root / linksafe
0755
rd
--
March 03 2024 22:43:41
root / linksafe
0755
ri
--
March 03 2024 22:43:41
root / linksafe
0755
stats
--
March 03 2024 22:43:41
root / linksafe
0755
alias.rb
2.093 KB
November 27 2012 04:28:14
root / linksafe
0644
anon_class.rb
0.139 KB
November 27 2012 04:28:14
root / linksafe
0644
any_method.rb
5.901 KB
January 23 2013 01:02:24
root / linksafe
0644
attr.rb
3.729 KB
January 23 2013 01:02:24
root / linksafe
0644
class_module.rb
19.149 KB
January 23 2013 01:02:24
root / linksafe
0644
code_object.rb
7.712 KB
January 23 2013 01:02:24
root / linksafe
0644
code_objects.rb
0.118 KB
November 27 2012 04:28:14
root / linksafe
0644
comment.rb
5.395 KB
November 27 2012 08:54:03
root / linksafe
0644
constant.rb
3.345 KB
November 27 2012 08:54:03
root / linksafe
0644
context.rb
28.258 KB
December 06 2012 06:20:50
root / linksafe
0644
cross_reference.rb
5.811 KB
January 04 2013 06:16:13
root / linksafe
0644
encoding.rb
2.744 KB
December 18 2012 08:24:57
root / linksafe
0644
erb_partial.rb
0.361 KB
November 27 2012 04:28:14
root / linksafe
0644
erbio.rb
0.775 KB
May 15 2011 11:55:52
root / linksafe
0644
extend.rb
2.525 KB
November 27 2012 04:28:14
root / linksafe
0644
generator.rb
1.723 KB
November 27 2012 04:28:14
root / linksafe
0644
ghost_method.rb
0.111 KB
November 27 2012 04:28:14
root / linksafe
0644
include.rb
2.614 KB
November 27 2012 04:28:14
root / linksafe
0644
known_classes.rb
2.58 KB
June 29 2011 21:17:31
root / linksafe
0644
markdown.rb
380.091 KB
December 01 2012 03:58:39
root / linksafe
0644
markup.rb
28.307 KB
November 27 2012 04:28:14
root / linksafe
0644
meta_method.rb
0.097 KB
November 27 2012 04:28:14
root / linksafe
0644
method_attr.rb
8.567 KB
November 27 2012 04:28:14
root / linksafe
0644
normal_class.rb
2.059 KB
November 27 2012 04:28:14
root / linksafe
0644
normal_module.rb
1.356 KB
November 27 2012 04:28:14
root / linksafe
0644
options.rb
28.488 KB
December 11 2012 07:44:56
root / linksafe
0644
parser.rb
7.826 KB
January 04 2013 06:16:13
root / linksafe
0644
rd.rb
3.538 KB
November 27 2012 04:28:14
root / linksafe
0644
rdoc.rb
13.254 KB
December 13 2012 07:58:47
root / linksafe
0644
require.rb
0.913 KB
November 27 2012 04:28:14
root / linksafe
0644
ri.rb
0.308 KB
November 27 2012 04:28:14
root / linksafe
0644
ruby_lex.rb
27.231 KB
December 18 2012 07:31:36
root / linksafe
0644
ruby_token.rb
11.214 KB
December 18 2012 07:31:36
root / linksafe
0644
rubygems_hook.rb
4.912 KB
December 14 2012 05:16:56
root / linksafe
0644
servlet.rb
10.831 KB
February 05 2013 08:24:20
root / linksafe
0644
single_class.rb
0.322 KB
November 27 2012 04:28:14
root / linksafe
0644
stats.rb
9.784 KB
November 27 2012 04:28:14
root / linksafe
0644
store.rb
22.318 KB
January 25 2013 00:15:08
root / linksafe
0644
task.rb
7.66 KB
November 27 2012 04:28:14
root / linksafe
0644
test_case.rb
3.464 KB
November 29 2012 23:34:29
root / linksafe
0644
text.rb
7.594 KB
January 30 2015 07:13:13
root / linksafe
0644
token_stream.rb
2.465 KB
November 27 2012 04:28:14
root / linksafe
0644
tom_doc.rb
5.695 KB
January 04 2013 06:16:13
root / linksafe
0644
top_level.rb
5.404 KB
January 23 2013 01:02:24
root / linksafe
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025
CONTACT ME
Static GIF