Class: Reddy::Literal::Language

Inherits:
Object
  • Object
show all
Defined in:
lib/reddy/literal.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(string) ⇒ Language

Returns a new instance of Language.



208
209
210
# File 'lib/reddy/literal.rb', line 208

def initialize(string)
  @value = string.to_s.downcase
end

Instance Attribute Details

#valueObject

Returns the value of attribute value.



207
208
209
# File 'lib/reddy/literal.rb', line 207

def value
  @value
end

Instance Method Details

#==(other) ⇒ Object



219
220
221
222
223
224
225
226
# File 'lib/reddy/literal.rb', line 219

def == (other)
  case other
  when String
    other == @value
  when self.class
    other.value == @value
  end
end

#clean(string) ⇒ Object



212
213
214
215
216
217
# File 'lib/reddy/literal.rb', line 212

def clean(string)
  case string
  when "eng"; "en"
  else string
  end
end

#to_sObject



228
# File 'lib/reddy/literal.rb', line 228

def to_s; @value; end