Class: HelloWorld

Inherits:
Object
  • Object
show all
Defined in:
yard_tags.rb

Overview

Author:

Version:

Callbacks (collapse)

Class Method Summary (collapse)

Instance Method Summary (collapse)

Class Method Details

+ (Object) define_hello_method(name)



109
110
111
112
113
114
115
116
# File 'yard_tags.rb', line 109

def self.define_hello_method(name)
  instance_eval do
    define_method("hello_#{name}") do
      puts "Hello #{name}"
    end
  end
  private("hello_#{name}")
end

Instance Method Details

- (Object) abstract_method

This method is abstract.

抽象メソッドなのでoverrideしてください

Raises:

  • (NotImplementedError)


10
11
12
# File 'yard_tags.rb', line 10

def abstract_method
  raise NotImplementedError
end

- (Object) after_filter



99
# File 'yard_tags.rb', line 99

def after_filter; end

- (Object) before_filter



98
# File 'yard_tags.rb', line 98

def before_filter; end

- (Object) deprecated_method

Deprecated.

このメソッドは非推奨です



15
16
17
# File 'yard_tags.rb', line 15

def deprecated_method
  puts "deprecated"
end

- (Object) example_method(arg = "arg_sample")

Examples:

メソッドの例を示します

example_method("given arg") # => "example given arg"


21
22
23
# File 'yard_tags.rb', line 21

def example_method(arg = "arg_sample")
  "example #{arg}"
end

- (Person?) find_friend(people = [])

Parameters:

  • people (Array<Person>) (defaults to: [])

    人名の配列

Returns:

  • (Person)

    友人の名前

  • (nil)

    友人が見つからなかった場合



71
72
73
# File 'yard_tags.rb', line 71

def find_friend(people = [])
  people.find(&:friend?)
end

- (Object) hello_friends(message = "hello", friends = [])

Parameters:

  • message (String) (defaults to: "hello")

    あいさつの内容

  • friends (Array<String>) (defaults to: [])

    あいさつする相手の配列



62
63
64
65
66
# File 'yard_tags.rb', line 62

def hello_friends(message = "hello", friends = [])
  friends.each do |friend|
    puts "Hello #{friend}"
  end
end

- (void) hello_joker1007 (private)

Note:

joker1007に挨拶する

This method returns an undefined value.



118
# File 'yard_tags.rb', line 118

define_hello_method :joker1007

- (void) hello_ryopeko (private)

Note:

ryopekoに挨拶する

This method returns an undefined value.



119
# File 'yard_tags.rb', line 119

define_hello_method :ryopeko

- (Object) hola(name = @reader)

See Also:



76
77
78
# File 'yard_tags.rb', line 76

def hola(name = @reader)
  "Hola!! #{name}"
end

- (Object) japanese(name = @reader, option = {yobisute: true})

Parameters:

  • option (Hash) (defaults to: {yobisute: true})

    a customizable set of options

Options Hash (option):

  • :type (Symbol)

    あいさつの種類

  • :yobisute(true) (Boolean)

    呼び捨てにするかどうか



32
33
34
35
36
37
38
39
40
# File 'yard_tags.rb', line 32

def japanese(name = @reader, option = {yobisute: true})
  aisatsu = 'こんにちは'
  keisyou = 'さま'

  aisatsu = 'ごきげんよう' if option[:type] == :ojou
  keisyou = '' if option[:yobisute]

  "#{aisatsu} #{name}#{keisyou}"
end

- (Object) my_poke(lang, name = @reader) - (Object) my_poke(lang, name = @reader)

Overloads:

  • - (Object) my_poke(lang, name = @reader)

    Parameters:

    • lang (String)

      2文字の言語名コードを文字列で表したもの

  • - (Object) my_poke(lang, name = @reader)

    Parameters:

    • lang (Symbol)

      2文字の言語名コードをシンボルで表したもの

Raises:

  • (ArgumentError)

    指定した言語コードに対応するメソッドが存在しない場合に発生



47
48
49
50
51
52
53
54
55
56
57
58
# File 'yard_tags.rb', line 47

def my_poke(lang, name = @reader)
  case lang.to_sym
  when :ja
    japanese name
  when :en
    english name
  when :es
    spanish name
  else
    raise ArgumentError
  end
end

- (Object) note_method(arg = "arg_sample")

Note:

ここは大事な説明です



26
27
28
# File 'yard_tags.rb', line 26

def note_method(arg = "arg_sample")
  "hello #{arg}"
end

- (Object) random_aisatsu(name = @reader, method_list = []) {|list| ... }

Yields:

  • (list)

    ランダムで実行するメソッドを選ぶためのフィルター

Yield Parameters:

  • list (Array<Symbol>)

    メソッド名のシンボルが格納された配列

Yield Returns:

  • (Symbol)

    選択されたメソッド名のしんぼる



90
91
92
93
94
# File 'yard_tags.rb', line 90

def random_aisatsu(name = @reader, method_list = [], &rule)
  method_list = [:english, :japanese, :spanish] if method_list.empty?
  select_method = yield method_list
  self.send select_method.to_sym, name
end

- (String) spanish(name = @reader)

スペイン語のあいさつ文

Parameters:

  • name (String) (defaults to: @reader)

    挨拶する人の名前

Returns:

  • (String)

    スペイン語のあいさつ文

Since:

  • 0.0.2



83
84
85
# File 'yard_tags.rb', line 83

def spanish(name = @reader)
  "Hola!! #{name}"
end