File: compass.rb

package info (click to toggle)
ruby-faker 2.21.0-1.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 10,076 kB
  • sloc: ruby: 19,088; makefile: 6
file content (202 lines) | stat: -rw-r--r-- 4,282 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
# frozen_string_literal: true

module Faker
  class Compass < Base
    class << self
      ##
      # Produces a random cardinal.
      #
      # @return [String]
      #
      # @example
      #   Faker::Compass.cardinal #=> "north"
      #
      # @faker.version 1.8.0
      def cardinal
        fetch('compass.cardinal.word')
      end

      ##
      # Produces a random ordinal.
      #
      # @return [String]
      #
      # @example
      #   Faker::Compass.ordinal #=> "northwest"
      #
      # @faker.version 1.8.0
      def ordinal
        fetch('compass.ordinal.word')
      end

      ##
      # Produces a random half wind.
      #
      # @return [String]
      #
      # @example
      #   Faker::Compass.half_wind #=> "north-northwest"
      #
      # @faker.version 1.8.0
      def half_wind
        fetch('compass.half-wind.word')
      end

      ##
      # Produces a random quarter wind.
      #
      # @return [String]
      #
      # @example
      #   Faker::Compass.quarter_wind #=> "north by west"
      #
      # @faker.version 1.8.0
      def quarter_wind
        fetch('compass.quarter-wind.word')
      end

      ##
      # Produces a random direction.
      #
      # @return [String]
      #
      # @example
      #   Faker::Compass.direction #=> "southeast"
      #
      # @faker.version 1.8.0
      def direction
        parse('compass.direction')
      end

      ##
      # Produces a random abbreviation.
      #
      # @return [String]
      #
      # @example
      #   Faker::Compass.abbreviation #=> "NEbN"
      #
      # @faker.version 1.8.0
      def abbreviation
        parse('compass.abbreviation')
      end

      ##
      # Produces a random azimuth.
      #
      # @return [String]
      #
      # @example
      #   Faker::Compass.azimuth #=> "168.75"
      #
      # @faker.version 1.8.0
      def azimuth
        parse('compass.azimuth')
      end

      ##
      # Produces a random cardinal abbreviation.
      #
      # @return [String]
      #
      # @example
      #   Faker::Compass.cardinal_abbreviation #=> "N"
      #
      # @faker.version 1.8.0
      def cardinal_abbreviation
        fetch('compass.cardinal.abbreviation')
      end

      ##
      # Produces a random ordinal abbreviation.
      #
      # @return [String]
      #
      # @example
      #   Faker::Compass.ordinal_abbreviation #=> "SW"
      #
      # @faker.version 1.8.0
      def ordinal_abbreviation
        fetch('compass.ordinal.abbreviation')
      end

      ##
      # Produces a random half wind abbreviation.
      #
      # @return [String]
      #
      # @example
      #   Faker::Compass.half_wind_abbreviation #=> "NNE"
      #
      # @faker.version 1.8.0
      def half_wind_abbreviation
        fetch('compass.half-wind.abbreviation')
      end

      ##
      # Produces a random quarter wind abbreviation.
      #
      # @return [String]
      #
      # @example
      #   Faker::Compass.quarter_wind_abbreviation #=> "SWbS"
      #
      # @faker.version 1.8.0
      def quarter_wind_abbreviation
        fetch('compass.quarter-wind.abbreviation')
      end

      ##
      # Produces a random cardinal azimuth.
      #
      # @return [String]
      #
      # @example
      #   Faker::Compass.cardinal_azimuth #=> "90"
      #
      # @faker.version 1.8.0
      def cardinal_azimuth
        fetch('compass.cardinal.azimuth')
      end

      ##
      # Produces a random ordinal azimuth.
      #
      # @return [String]
      #
      # @example
      #   Faker::Compass.ordinal_azimuth #=> "135"
      #
      # @faker.version 1.8.0
      def ordinal_azimuth
        fetch('compass.ordinal.azimuth')
      end

      ##
      # Produces a random half wind azimuth.
      #
      # @return [String]
      #
      # @example
      #   Faker::Compass.half_wind_azimuth #=> "292.5"
      #
      # @faker.version 1.8.0
      def half_wind_azimuth
        fetch('compass.half-wind.azimuth')
      end

      ##
      # Produces a random quarter wind azimuth
      #
      # @return [String]
      #
      # @example
      #   Faker::Compass.quarter_wind_azimuth #=> "56.25"
      #
      # @faker.version 1.8.0
      def quarter_wind_azimuth
        fetch('compass.quarter-wind.azimuth')
      end
    end
  end
end